-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
40 lines (34 loc) · 1002 Bytes
/
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
const express = require("express");
const app = express();
const path = require("path");
const port = 3000;
const swaggerJsDoc = require("swagger-jsdoc");
const swaggerUI = require("swagger-ui-express");
const swaggerOptions = {
swaggerDefinition: {
info: {
title: "Sony ConTroller - API",
description: "API for sony TV's",
},
servers: ["http://localhost:3000"],
},
apis: [__dirname + "/Routes/*.js"],
};
const swaggerDocs = swaggerJsDoc(swaggerOptions);
app.use("/docs", swaggerUI.serve, swaggerUI.setup(swaggerDocs));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(require("./Routes/hello"));
app.use(require("./Routes/tv"));
app.set("view engine", "ejs");
app.set("views", path.join(__dirname + "/views"));
app.use(express.static(__dirname + "/public"));
// Launch app on port
app.listen(port, () =>
console.log(
"\x1b[31m%s\x1b[0m",
"[SERVER]",
"\x1b[32m[WEB]\x1b[0m",
`Connected @ localhost:${port}`
)
);