-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
36 lines (27 loc) · 931 Bytes
/
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
var pool = require("./pool");
pool = pool.getPool();
var RssWriter = require("./rssWriter");
var RssReader = require("./rssReader");
var express = require('express');
var app = express();
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({ secret: "Ninja Le monde est à toi !" }));
try {
app.get('/rss/:flux.xml', function(request, response){
response.contentType("rss");
setTimeout(function(req, res) {
return RssWriter.getRss(req, res);
}(request, response), 5000);
});
app.get('/readRss/:rssId/:lastlyRead/:otherName?', function(request, response){
response.header('Content-Type', 'application/json; charset=UTF-8');
response.header('Access-Control-Allow-Origin', '*');
setTimeout(function(req, res) {
return RssReader.readRss(req, res);
}(request, response), 500);
});
app.listen(8080);
} catch (err) {
console.log('EXCEPTION : ' + err);
}