Skip to content

Instantly share code, notes, and snippets.

@robertklep
Created July 22, 2019 18:32
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertklep/93fb9122a20e4acacc44161fbacca496 to your computer and use it in GitHub Desktop.
Save robertklep/93fb9122a20e4acacc44161fbacca496 to your computer and use it in GitHub Desktop.
// to test:
// $ echo 'GET / HTTP/1.0\n\n' | nc localhost 3012
const app = require('express')();
const server = app.listen(3012);
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
app.get('/', async (req, res) => {
res.write("USERID,NAME,FBID,ACCOUNT,SUBSCRIPTION,PRICE,STATE,TIMEPERIOD\n");
for (var i = 0; i < 10; i++) {
res.write("23,John Doe,1234,500,SUBSCRIPITON,100,ACTIVE,30\n");
await delay(1000);
}
res.end();
});
@NikolaiT
Copy link

Better test this server with: curl http://localhost:3012 -N

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment