Created
July 10, 2018 17:45
-
-
Save laduke/56a076d304967649ae461375394db633 to your computer and use it in GitHub Desktop.
simple html index
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
var http = require('http') | |
var { html, title, head, body, div } = require('hyperaxe') | |
var page = html( | |
head(title('hi')), | |
body( | |
div({ id: 'app' }) | |
) | |
).outerHTML | |
http.createServer(function (req, res) { | |
res.write(page) | |
res.end() | |
}).listen(8899) |
Author
laduke
commented
Jul 10, 2018
var http = require('http')
var h = require('hyperscript')
var fromString = require('from2-string')
var page = h(
'html'
, h('head'
, h('title', 'the title'))
, h('body'
, h('div', { id: 'app' }))
).outerHTML
http.createServer(function (req, res) {
fromString(page).pipe(res)
}).listen(8899)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment