forked from stremlenye/immutable-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
60 lines (45 loc) · 1.14 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
app.get('/', function (req, res) {
console.log("some_get_info");
res.send("some_get_info");
});
app.get('/test', function (req, res) {
console.log("some_get_info");
res.send("some_get_info");
});
app.get('/query', function (req, res) {
console.log(req.query);
res.send(req.query);
});
app.post('/', function (req, res) {
console.log(req.body);
res.json(req.body);
});
app.post('/test', function (req, res) {
console.log(req.body);
res.json(req.body);
});
app.put('/', function (req, res) {
console.log(req.body);
res.json(req.body);
});
app.put('/test', function (req, res) {
console.log(req.body);
res.json(req.body);
});
app.delete('/', function (req, res) {
console.log(req.body);
res.json(req.body);
});
app.delete('/test', function (req, res) {
console.log(req.body);
res.json(req.body);
});
var server = app.listen(3000, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});