-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
68 lines (56 loc) · 2.48 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const express = require("express")
const path = require("path")
const cors = require("cors")
console.log(`
Created with
███████╗██╗ ██╗███████╗██╗ ██████╗ ███╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗
██╔════╝██║ ██║██╔════╝██║██╔═══██╗████╗ ██║ ██╔════╝██╔═══██╗██╔══██╗██╔════╝
█████╗ ██║ ██║███████╗██║██║ ██║██╔██╗ ██║ ██║ ██║ ██║██║ ██║█████╗
██╔══╝ ██║ ██║╚════██║██║██║ ██║██║╚██╗██║ ██║ ██║ ██║██║ ██║██╔══╝
██║ ╚██████╔╝███████║██║╚██████╔╝██║ ╚████║███████╗╚██████╗╚██████╔╝██████╔╝███████╗
╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
Fusion_Code. 2018.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
*`)
global.__basedir = __dirname
const app = express()
app.use(
express.json({
extended: false
})
)
app.use(cors())
app.disable("x-powered-by")
app.use((req, res, next) => {
res.setHeader("X-Content-Type-Options", "nosniff")
res.setHeader("X-XSS-Protection", "1")
res.setHeader(
"Strict-Transport-Security",
"max-age=31536000; includeSubDomains"
)
next()
})
/**
* Api Directories
*
*/
app.use("/api/v1", require("./server/api/v1/routes"))
/**
* Static file serving directories
*
*/
app.use(express.static(path.join(__dirname, "public/")))
app.use(express.static(path.join(__dirname, "client/")))
app.use(express.static(path.join(__dirname, "node_modules")))
app.get("*", function(req, res) {
res.sendFile(path.join(__dirname, "client", "index.html"))
})
/**
* Launch Server
*
*/
const port = process.env.PORT || 5000
app.listen(port, () => {
console.log("listening on port", port)
})