-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
57 lines (42 loc) · 1.23 KB
/
index.js
File metadata and controls
57 lines (42 loc) · 1.23 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const express = require("express")
const app = express();
var bodyParser = require('body-parser')
var fs = require('fs');
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.set('views', __dirname + '/views');
app.engine('html', require('ejs').renderFile);
app.use('/static', express.static('static'))
//app.use('/', express.static('./'))
const Client = require("replitdb-client");
const client = new Client();
app.use('/api/v1', require('./api'));
app.get('/', function(req, res) {
res.render("index.html")
});
app.get('/dashboard', function(req, res) {
res.render("dashboard.html")
});
app.get('/resources', function(req, res) {
res.render("resources.html")
});
app.get('/acknowledgements', function(req, res) {
res.render("acknowledgements.html")
});
app.get('/mybadges', function(req, res) {
res.render("mybadges.html")
});
app.get('/games', function(req, res) {
res.render("games.html")
});
app.get("/badges", function(req, res) {
fs.readFile('badges.json', 'utf8', function (err, data) {
if (err) throw err;
obj = JSON.parse(data);
res.send(obj);
});
});
let port = 8080;
app.listen(port, () => {
console.log(`Website listening at http://localhost:${port}`)
});