-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathindex.js
32 lines (27 loc) · 754 Bytes
/
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
import express from "express";
const app = express();
import home from './routes/home.js';
import en from './routes/en.js';
import dutch from './routes/dutch.js';
import pronounce from './routes/pronounce.js';
app.use('/', home);
app.use('/word/dutch', dutch);
app.use('/word', en);
app.use('/pronounce', pronounce);
app.use('/', function(req, res) {
res.status(404).json({
error: 1,
message: 'Page or Data not Found'
});
})
app.use((err, req, res, next) => {
if (!err) return next();
return res.status(403).json({
error: 1,
message: 'Page or Data not Found'
});
});
const port = process.env.PORT || 3000;
app.listen(port, function() {
console.log('listening on port localhost: ' + port);
});