app.js
450 Bytes
'use strict'
var http = require('http');
var data = require('./data.json');
var Handlebars = require('handlebars');
var fs = require('fs');
var template = fs.readFileSync('./views/detail.hbs', 'utf-8');
var templateFn = Handlebars.compile(template);
var server = http.createServer(function (req, res) {
var result = templateFn(data);
res.end(result);
});
server.listen(3000, function () {
console.log('Server running on port 3000')
});