Created
July 27, 2016 20:10
-
-
Save alfredwesterveld/d18d8b1d7834f4417410297d638f27b8 to your computer and use it in GitHub Desktop.
fake longpoll server
This file contains hidden or 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
| 'use strict'; | |
| const http = require('http'); | |
| const hostname = '127.0.0.1'; | |
| const port = 3000; | |
| let i = 0; | |
| const server = http.createServer((req, res) => { | |
| setTimeout(() => { | |
| console.log(i++); | |
| res.statusCode = 200; | |
| res.setHeader('Content-Type', 'text/plain'); | |
| res.end('Hello World\n'); | |
| }, 1000); | |
| }); | |
| server.listen(port, hostname, () => { | |
| console.log(`Server running at http://${hostname}:${port}/`); | |
| }); |
This file contains hidden or 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
| { | |
| "name": "fake-longpoll", | |
| "version": "0.0.1", | |
| "description": "fake longpoll server", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "author": "", | |
| "license": "ISC" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment