-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
30 lines (19 loc) · 780 Bytes
/
app.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
const express = require('express');
const app = express();
const path = require('path');
const query = require('./db/queries');
const morganLogger = require('morgan');
const bodyParser = require('body-parser');
app.use(morganLogger('dev'));
app.use(bodyParser.json())
app.use('/', express.static(path.join(__dirname, '/dist/')));
// These are the routes the components use
app.get('/dbcharacter/:id', query.getCharacter);
app.get('/dbcharacterCount', query.getCharacterCount);
app.get('/dbPost/:id/:username/:simplified', query.getPosts);
// This is the default route for any request
app.get('/*', (req, res) => {
console.log(path.join(__dirname, '/dist/') + 'index.html');
res.sendFile(path.join(__dirname, '/dist/') + 'index.html');
} )
module.exports = app;