-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathserver.js
More file actions
36 lines (31 loc) · 1.02 KB
/
server.js
File metadata and controls
36 lines (31 loc) · 1.02 KB
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
const express = require('express')
const path = require('path')
const app = express()
var ip = require("ip");
var cors = require("cors");
app.use(express.static(path.join(__dirname, 'build')))
app.use(cors());
app.get('/message', (req, res) => {
return res.send(process.env.PAGE_TITLE)
})
app.get('/color', (req, res) => {
if (process.env.PAGE_COLOR==="Blue" || process.env.PAGE_COLOR==="blue")
return res.send("#053354")
if (process.env.PAGE_COLOR==="Green" || process.env.PAGE_COLOR==="green")
return res.send("#002e0e")
if (process.env.PAGE_COLOR==="Red" || process.env.PAGE_COLOR==="red")
return res.send("#360300")
if (process.env.PAGE_COLOR==="Black" || process.env.PAGE_COLOR==="black")
return res.send("#262626")
return res.send("#262626")
})
app.get('/version', (req, res) => {
return res.send(process.version)
})
app.get('/ipaddress', (req, res) => {
return res.send(ip.address())
})
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'build', 'index.html'))
})
app.listen(8080)