Skip to content

Commit 6b357d4

Browse files
committed
Upgrade to Servie 4
1 parent 2927764 commit 6b357d4

File tree

11 files changed

+3192
-2733
lines changed

11 files changed

+3192
-2733
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ notifications:
77
on_failure: change
88

99
node_js:
10-
- '6'
10+
- "8"
1111
- stable
1212

1313
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"

benchmarks/express.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const { createServer } = require('http')
2-
const express = require('express')
1+
const { createServer } = require("http");
2+
const express = require("express");
33

4-
const port = 4000
5-
const app = express()
4+
const port = 4000;
5+
const app = express();
66

7-
app.get('/', function (req, res) {
8-
res.send('hello world')
9-
})
7+
app.get("/", function(req, res) {
8+
res.send("hello world");
9+
});
1010

11-
createServer(app).listen(port, () => console.log('express running:', port))
11+
createServer(app).listen(port, () => console.log("express running:", port));

benchmarks/http.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
const { createServer } = require('http')
2-
const parseurl = require('parseurl')
1+
const { createServer } = require("http");
2+
const parseurl = require("parseurl");
33

4-
const port = 4000
4+
const port = 4000;
55

6-
function app (req, res) {
7-
const Url = parseurl(req)
6+
function app(req, res) {
7+
const Url = parseurl(req);
88

9-
if (req.method === 'GET' && Url.pathname === '/') {
10-
res.setHeader('Content-Type', 'text/plain')
11-
res.setHeader('Content-Length', '11')
12-
res.end('hello world')
13-
return
9+
if (req.method === "GET" && Url.pathname === "/") {
10+
res.setHeader("Content-Type", "text/plain");
11+
res.setHeader("Content-Length", "11");
12+
res.end("hello world");
13+
return;
1414
}
1515

16-
res.statusCode = 404
17-
res.end()
16+
res.statusCode = 404;
17+
res.end();
1818
}
1919

20-
createServer(app).listen(port, () => console.log('http running:', port))
20+
createServer(app).listen(port, () => console.log("http running:", port));

benchmarks/servie.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
const { createServer } = require('http')
2-
const { Response } = require('servie')
3-
const { createBody } = require('servie/dist/body/node')
4-
const route = require('servie-route')
5-
const { createHandler } = require('../dist/index')
1+
const { createServer } = require("http");
2+
const { Response } = require("servie/dist/node");
3+
const { get } = require("servie-route");
4+
const { createHandler } = require("../dist");
65

7-
const port = 4000
6+
const port = 4000;
87

9-
const app = createHandler(route.get('/', () => {
10-
return new Response({ body: createBody('hello world') })
11-
}))
8+
const app = createHandler(
9+
get("/", () => {
10+
return new Response("hello world");
11+
})
12+
);
1213

13-
createServer(app).listen(port, () => console.log('servie running:', port))
14+
createServer(app).listen(port, () => console.log("servie running:", port));

0 commit comments

Comments
 (0)