-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
29 lines (22 loc) · 886 Bytes
/
server.js
File metadata and controls
29 lines (22 loc) · 886 Bytes
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
const express = require('express');
const cookieParser = require('cookie-parser');
const mustacheExpress = require('mustache-express');
const bodyParser = require('body-parser');
const path = require('path');
const public = path.join(__dirname,'public');
const router = require('./routes/tspnRoutes');
const PORT = process.env.PORT || 3000;
require('dotenv').config();
const app = express();
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(express.static(public));
app.use('/css', express.static(__dirname +'/css/styles.css'));
app.use('/', router);
app.engine('mustache', mustacheExpress());
app.set('view engine', 'mustache');
app.set('views', path.join(__dirname, 'public', 'views'));
app.listen(PORT, () => {
console.log(`Server is running on port http://localhost:${PORT}`);
});