forked from TeamCookCaps/BackImageAPP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
26 lines (23 loc) · 687 Bytes
/
app.js
File metadata and controls
26 lines (23 loc) · 687 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
import http from "http";
import express from "express";
import WebSocket, { WebSocketServer } from "ws";
import loaders from "./loaders/index.js";
import logger from "./loaders/logger.js";
import socket from "./loaders/websocket.js";
const app = express();
const port = 4000;
const server = http.createServer(app);
//db, express, log 관련 모듈 로드
loaders(app);
const wss = new WebSocketServer({ server });
socket(wss);
server.listen(port, () => {
logger.info(`
##############################################
Server listening on port: ${port}
############################################## `);
})
.on("error", (err) => {
logger.error(err);
process.exit(1);
});