Telemark with Express.js

node v8.17.0
version: 2.0.0
endpointsharetweet
const express = require('express') const app = express() const markup = require("telemark/dist/telemark-html.min.js") markup.html.init(this) markup.specify('acme:link', function (url, label) { return a(href(url), text(label)) }) const links = { 'This Example': 'https://runkit.com/mrolafsson/telemark-with-express-js', 'Github': 'https://github.com/mrolafsson/telemark', 'Runkit': 'https://npm.runkit.com/telemark', 'NPM': 'https://www.npmjs.com/package/telemark' } app.get('/', (req, res) => res.send( html( head( style('section { width: 100%; text-align: center; } h1 { font-size: 2em; } ul { list-style: none; }') ), body( section( h1('Lovingly crafted with Telemark, and executed on Runkit.') ), section( p('Super-lightweight templating of HTML with plain JavaScript.'), ul( iterate(links, function (url, label) { return li( acme.link(url, label) ) }) ) ) ) ).make() )) app.listen(3000, () => console.log('Example app listening on port 3000!'))
Loading…

no comments

    sign in to comment