-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.js
53 lines (50 loc) · 1.33 KB
/
swagger.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const swaggerAutogen = require("swagger-autogen")({ openapi: "3.0.0" });
const outputFile = "build/swagger_output.json";
const endpoints = ["src/routes.js"];
const docs = {
info: {
version: "1.0.0",
title: "iXp Tech For Dummies / Tech For Techs example API",
description:
"A simple API for an ATM for you to explore ☺\n\nCreated with love by Rafael Lawisch and Vinícius Lora for the best internship experience ever ❤",
},
host: "localhost:3000",
basePath: "/",
schemes: ["http", "https"],
consumes: ["application/json"],
produces: ["application/json"],
tags: [
{
name: "Auth",
description: "Log in and log out",
},
{
name: "Account Operations",
description:
"Create and close account, see account overview and request other users' account number",
},
{
name: "ATM Operations",
description:
"See account balance and make deposits, withdrawals and transfers",
},
],
securityDefinitions: {
logged_in: {
type: "apiKey",
in: "cookie",
name: "userEmail",
description: "Needs to be logged in to access this route",
},
},
definitions: {
Login: {
$email: "[email protected]",
$password: "123456",
},
Amount: {
$amount: 1000.0,
},
},
};
swaggerAutogen(outputFile, endpoints, docs);