Last active
April 18, 2018 10:31
-
-
Save rook2pawn/66d6fa00a43de42ce3dc489b4980370b 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
// app.js | |
var html = require('choo/html') | |
var choo = require('choo') | |
var app = choo() // 1. | |
app.route('/', view) // 2. | |
app.route('/second', second) // 2. | |
app.mount('body') // 3. | |
function view () { // 4. | |
return html` | |
<body> | |
<h2>Hello World</h2> | |
<a href="/second"> | |
Navigate to the next route. | |
</a> | |
</body> | |
` | |
} | |
function second () { | |
return html` | |
<body> | |
<a href="/"> | |
Navigate back. | |
</a> | |
</body> | |
` | |
} | |
// server.js | |
const http = require("http") | |
const ecstatic = require("ecstatic")(__dirname) | |
const server = http.createServer(ecstatic) | |
server.listen(5150) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// server-that-fixes.js