Skip to content

Commit 28a0f19

Browse files
committed
feat: initial api docs with scalar
1 parent a27afb1 commit 28a0f19

File tree

4 files changed

+2194
-2
lines changed

4 files changed

+2194
-2
lines changed

app/views/email-api.pug

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
block body
2+
#app
3+
4+
// Load the Script
5+
script(src="https://cdn.jsdelivr.net/npm/@scalar/api-reference")
6+
7+
// Initialize the Scalar API Reference
8+
script.
9+
window.WEB_URL = "#{ config.WEB_URL }";
10+
window.API_TOKEN = "#{user[config.userFields.apiToken]}";
11+
Scalar.createApiReference("#app", {
12+
// The URL of the OpenAPI/Swagger document
13+
url: `${window.WEB_URL}/api-spec.json`,
14+
authentication: {
15+
preferredSecurityScheme: "ApiKeyAuth",
16+
securitySchemes: {
17+
ApiKeyAuth: {
18+
username: window.API_TOKEN,
19+
password: "",
20+
},
21+
AliasAuth: {
22+
name: "Authorization",
23+
in: "header",
24+
value: window.API_TOKEN,
25+
},
26+
},
27+
},
28+
});

0 commit comments

Comments
 (0)