forked from astonishingowls/bougiebatz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
42 lines (28 loc) · 1.03 KB
/
server.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
var express = require('express');
var path = require('path');
var cors = require('cors');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
var newsRoutes = require('./server/routes/newsRoutes');
// var userRoutes = require('./server/routes/userRoutes');
var articleRoutes = require('./server/routes/articleRoutes')
app.use('/api', newsRoutes);
// app.use('/api', userRoutes);
app.use('/api', articleRoutes)
// webpack loads index.html, looks for script src
app.get('/public/bundle.js', function(req, res){
res.sendFile(path.join(__dirname, 'client/public/bundle.js'));
});
app.get('/styles/style.css', function(req, res){
res.sendFile(path.join(__dirname, 'client/styles/style.css'));
});
app.get('*', function(req, res){
console.log('REQ.URL IS: ', req.url);
res.sendFile(path.join(__dirname, 'client/index.html'));
});
app.listen(process.env.PORT || 9000);
// <link rel='stylesheet' href='styles/style.css' media='screen' title='no title'>