-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2927764
commit 6b357d4
Showing
11 changed files
with
3,192 additions
and
2,733 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
const { createServer } = require('http') | ||
const express = require('express') | ||
const { createServer } = require("http"); | ||
const express = require("express"); | ||
|
||
const port = 4000 | ||
const app = express() | ||
const port = 4000; | ||
const app = express(); | ||
|
||
app.get('/', function (req, res) { | ||
res.send('hello world') | ||
}) | ||
app.get("/", function(req, res) { | ||
res.send("hello world"); | ||
}); | ||
|
||
createServer(app).listen(port, () => console.log('express running:', port)) | ||
createServer(app).listen(port, () => console.log("express running:", port)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
const { createServer } = require('http') | ||
const parseurl = require('parseurl') | ||
const { createServer } = require("http"); | ||
const parseurl = require("parseurl"); | ||
|
||
const port = 4000 | ||
const port = 4000; | ||
|
||
function app (req, res) { | ||
const Url = parseurl(req) | ||
function app(req, res) { | ||
const Url = parseurl(req); | ||
|
||
if (req.method === 'GET' && Url.pathname === '/') { | ||
res.setHeader('Content-Type', 'text/plain') | ||
res.setHeader('Content-Length', '11') | ||
res.end('hello world') | ||
return | ||
if (req.method === "GET" && Url.pathname === "/") { | ||
res.setHeader("Content-Type", "text/plain"); | ||
res.setHeader("Content-Length", "11"); | ||
res.end("hello world"); | ||
return; | ||
} | ||
|
||
res.statusCode = 404 | ||
res.end() | ||
res.statusCode = 404; | ||
res.end(); | ||
} | ||
|
||
createServer(app).listen(port, () => console.log('http running:', port)) | ||
createServer(app).listen(port, () => console.log("http running:", port)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
const { createServer } = require('http') | ||
const { Response } = require('servie') | ||
const { createBody } = require('servie/dist/body/node') | ||
const route = require('servie-route') | ||
const { createHandler } = require('../dist/index') | ||
const { createServer } = require("http"); | ||
const { Response } = require("servie/dist/node"); | ||
const { get } = require("servie-route"); | ||
const { createHandler } = require("../dist"); | ||
|
||
const port = 4000 | ||
const port = 4000; | ||
|
||
const app = createHandler(route.get('/', () => { | ||
return new Response({ body: createBody('hello world') }) | ||
})) | ||
const app = createHandler( | ||
get("/", () => { | ||
return new Response("hello world"); | ||
}) | ||
); | ||
|
||
createServer(app).listen(port, () => console.log('servie running:', port)) | ||
createServer(app).listen(port, () => console.log("servie running:", port)); |
Oops, something went wrong.