-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
38 lines (29 loc) · 982 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
34
35
36
37
38
var express = require('express');
var postcontrol = require('./model/postctrl.js');
var bodyParser = require('body-parser');
var path = require('path');
var app = express();
var postControl = new postcontrol();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname, 'public')));
app.listen(process.env.PORT || 5000);
app.get('/', function( req, res ) {
// postControl.getPosts(res);
res.sendFile(path.join(__dirname, 'views/index.html'));
});
app.get('/getToutiaoPosts', function( req, res ) {
postControl.getToutiaoPosts(res);
});
app.get('/getSegmentPosts', function( req, res) {
postControl.getSegmentPosts(res);
});
app.get('/getGeekPosts', function( req, res) {
postControl.getGeekPosts(res);
});
app.get('/getHTML5DreamsPosts', function( req, res ) {
postControl.getHTML5DreamsPosts(res);
});
app.get('/getTutorialzinePosts', function( req, res) {
postControl.getTutorialzinePosts(res);
});