-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
33 lines (27 loc) · 957 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
27
28
29
30
31
32
33
import express from 'express';
import bodyParser from 'body-parser';
import methodOverride from 'method-override';
import cookieParser from 'cookie-parser';
import router from 'express-mapping';
import session from 'express-session';
import renderer from 'react-engine';
import filter from './lib/filter';
const app = express();
const PORT = 4000;
const engine = renderer.server.create({
reactRoutes: `${__dirname}/component/routes.jsx`
});
app.engine('.jsx', engine);
app.set('views', `${__dirname}/component/views`);
app.set('view engine', 'jsx');
app.set('view', renderer.expressView);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(methodOverride());
app.use(cookieParser());
app.use(express.static(`${__dirname}/public`));
app.use(filter);
app.use(router('routes'));
app.listen(PORT, function () {
console.log('The server is running at port:' + PORT);
});