-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
26 lines (22 loc) · 880 Bytes
/
server.js
File metadata and controls
26 lines (22 loc) · 880 Bytes
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
require("json-bigint-patch");
require("dotenv").config();
const { env } = process;
const http = require("http");
const cors = require("cors");
const express = require("express");
const cmdService = require("./src/utils/cmd.service");
const expressService = require("./src/utils/express.service");
const { end, init, route404 } = require("./src/utils/request.service");
const server = express();
server.use(express.json(), cors());
const httpServer = http.createServer(server);
expressService.importRoutes(server, "./src");
server.use(init, route404, end);
httpServer.listen(env.PORT, () => {
const CMD_STYLE = cmdService.getCMDStyleCodes();
console.log("");
expressService.printServerUpStatus();
console.log(
`\t[NodeJs] ${CMD_STYLE.UNDERLINE}${CMD_STYLE.BOLD}listening on port ${CMD_STYLE.GREEN}${env.PORT}${CMD_STYLE.DEFAULT}\nRequests: `
);
});