-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
64 lines (53 loc) · 1.58 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
require("dotenv").config();
const express = require("express");
const app = express();
const router = require("./route/routes");
const swaggerJsdoc = require("swagger-jsdoc");
const swaggerUI = require("swagger-ui-express");
// const swaggerDef = require("./helper/swagger_template.helper");
const port = process.env.PORT || 3000;
// const swaggerOptions = {
// swaggerDefinition: {
// openapi: "3.0.0",
// info: {
// title: "Implementation Swagger to Backend Challenge 5",
// version: "1.0.0",
// description: "API MyBank for Users, Accounts, Transactions",
// },
// components: {
// securitySchemes: {
// bearerAuth: {
// type: "apiKey",
// in: "header",
// name: "Authorization",
// // scheme: 'bearer',
// // bearerFormat: 'JWT',
// description: "Input your Token for Get Access",
// },
// },
// },
// servers: [
// {
// url: "http://localhost:8080",
// },
// {
// url: "http://localhost:3000",
// },
// ],
// },
// apis: [
// "./routes/auth.route.js",
// "./routes/user.route.js",
// "./routes/account.route.js",
// "./routes/transaction.route.js",
// ],
// };
// const swaggerSpec = swaggerJsdoc(swaggerOptions);
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use("/images", express.static("media/images"));
app.use("/", router);
// app.use("/docs", swaggerUI.serve, swaggerUI.setup(swaggerSpec));
app.listen(port, () => {
console.log(`service running on port ${port}`)
})