-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
35 lines (32 loc) · 898 Bytes
/
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
const express = require('express');
const app = express();
const path = require('path');
const html = require('html');
const php = require('php');
const ejs = require('ejs');
const server_conf = require('./server.conf.json');
app.use(express.static(path.join(__dirname, 'src')));
app.engine('html', ejs.renderFile);
app.set('views', './views');
app.set('view engine', 'ejs');
// files
app.get('/shop', (req, res) => {
res.render('shop.html');
})
app.get('/about', (req, res) => {
res.render('about.html');
})
app.get('/open-source', (req, res) => {
res.render('open-source.html');
})
app.get('/discord', (req, res) => {
res.render('discord.html');
})
app.get('*', (req, res) => {
var route = req.url;
res.render('404.html', { route });
})
// Running a site
app.listen(server_conf.port, () => {
console.log(`server running on http://localhost:${server_conf.port}`);
})