-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
46 lines (36 loc) · 1.14 KB
/
index.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
const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const fs = require('fs');
const url = require('url');
const favicon = require('serve-favicon');
const PORT = process.env.PORT || 3000;
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true}));
app.set('view engine', 'ejs');
// we got the css, but not images and js
app.use(express.static(__dirname + '/public'));
// ******** All routes here ****************
// app.use('/about', (req, res, next) => {
// res.sendFile('about');
// });
app.get('/', (req, res, next) => {
res.render('home');
});
app.get('/educator.html', (req, res, next) => {
res.render('educator');
});
app.get('/sponsor.html', (req, res, next) => {
res.render('sponsor');
});
app.get('/participant.html', (req, res, next) => {
res.render('participant');
});
app.get('/volunteer.html', (req, res, next) => {
res.render('volunteer');
});
app.listen(PORT, function() {
console.log('App Started');
});
console.log(`Server is listening on port ${PORT}`);