-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
34 lines (30 loc) · 1.1 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
import express from "express";
import http from "node:http";
import publicMiddleware from "./lib/routes/middleware/index.js";
import "dotenv/config";
import accountRouter from "./lib/routes/account.js";
import sportsRouter from "./lib/routes/sports/index.js";
import noticeRouter from "./lib/routes/notice/index.js";
import myPageRouter from "./lib/routes/mypage/index.js";
import { Server } from "socket.io";
import initServerSocket from "./lib/socket/index.js";
import "./mongo.js";
import { matchMaker } from "./lib/controllers/sports/matchMaker/matchMaking.js";
const app = express();
const port = process.env.PORT || 3000;
const server = http.createServer(app);
app.use(publicMiddleware);
app.use("/account", accountRouter);
app.use("/sports", sportsRouter);
app.use("/mypage", myPageRouter);
app.use("/notice", noticeRouter);
const serverSocket = new Server(server);
initServerSocket(serverSocket);
server.listen({ port: port, host: "localhost" }, () => {
console.log(
`express server connection established.... => ${server.address().address}:${
server.address().port
}`
);
});
matchMaker("rps");