Created
March 29, 2023 08:04
-
-
Save dsathyakumar/4cb445820ca12a177a384ca1435bf56b to your computer and use it in GitHub Desktop.
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
require('marko/node-require').install(); | |
const http = require('http'); | |
const server = require('http').createServer(); | |
const port = 8080; | |
server.on('request', (req, res) => { | |
var out = require('async-writer').create(res) | |
.on('error', function(err) { | |
// Something went wrong during writing | |
}) | |
.on('end', function() { | |
// Value of output: "ABC" | |
}); | |
out.write('A'); | |
out.write('B'); | |
out.write('C'); | |
out.end(); | |
}); | |
server.listen(port, () => { | |
console.log(`Successfully started server on port ${port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment