crafatar/lib/routes/index.js
jomo b84a65fd8e restructure directories
www.js is our 'main' file, it's now at the project's root instead of server.js
routes, views, assets are now in lib, too
2015-04-06 03:06:38 +02:00

19 lines
485 B
JavaScript

var config = require("../config");
var path = require("path");
var jade = require("jade");
// compile jade
var index = jade.compileFile(path.join(__dirname, "../views/index.jade"));
module.exports = function(req, res) {
var html = index({
title: "Crafatar",
domain: "https://" + req.headers.host,
config: config
});
res.writeHead(200, {
"Content-Length": Buffer.byteLength(html, "UTF-8"),
"Content-Type": "text/html; charset=utf-8"
});
res.end(html);
};