Created
March 29, 2023 08:00
-
-
Save dsathyakumar/b21d6f007014afd28445ebb93499e237 to your computer and use it in GitHub Desktop.
whatever written after .render doesnt show up
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; | |
const indexTemplate = require('./index.marko'); | |
server.on('request', (req, res) => { | |
res.write('<h1>------Before body--------</h1>'); | |
indexTemplate.render({ | |
name: 'Frank', | |
count: 30, | |
colors: ['red', 'green', 'blue'] | |
}, res); | |
res.write('<h1>------After body--------</h1>'); | |
}); | |
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