-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
39 lines (32 loc) · 1.09 KB
/
server.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
process.__dirname = __dirname
const { serverInit } = require("./utils/server-helpers")
const expressFileUpload = require("express-fileupload")
const cookieParser = require("cookie-parser")
const config = require("./utils/config")
const socketIo = require("socket.io")
const express = require("express")
const http = require("http")
const path = require("path")
const app = express()
const server = http.createServer(app)
const io = new socketIo.Server(server)
serverInit()
app.use(express.static(path.join(__dirname, "public")))
app.use(express.urlencoded({ extended: false }))
app.set("views", path.join(__dirname, "views"))
app.set("view engine", "ejs")
app.use(expressFileUpload())
app.use(cookieParser())
app.use(express.json())
global.IO = io
// non checking
app.use("/tar", require("./router/tar"))
// checking
app.use("/", require("./router"))
app.use("/fm", require("./router/fm"))
app.use("/panel", require("./router/panel"))
app.use("/create", require("./router/create"))
const PORT = process.env.PORT || config.port
server.listen(PORT, () => {
console.log(`RUNNING ON: http://localhost:${PORT}`)
})