Skip to content

Instantly share code, notes, and snippets.

@andrunix
Created April 26, 2016 19:44
Show Gist options
  • Save andrunix/63fca6dbedfc2eb7686bef011edf3178 to your computer and use it in GitHub Desktop.
Save andrunix/63fca6dbedfc2eb7686bef011edf3178 to your computer and use it in GitHub Desktop.
html
body
h1= hello world
'use strict';
const Hapi = require('hapi');
const Vision = require('vision');
const internals = {};
const rootHandler = function(request, reply) {
reply.view('index', {
title: 'Andrew Title',
message: 'Hello bitches'
});
};
internals.main = function() {
const server = new Hapi.Server();
server.connection({ port: 8000 });
debugger;
server.register(Vision, (err) => {
debugger;
if (err) throw err;
server.views({
engines: { jade: require('jade') },
path: __dirname + '/templates',
compileOptions: {
pretty: true
}
});
server.route({ method: 'GET', path: '/', handler: rootHandler });
debugger;
server.start((err) => {
if (err) throw err;
console.log('Server is listening at ' + server.info.uri);
});
});
};
internals.main();
{
"name": "jade-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"boom": "^3.1.2",
"hoek": "^4.0.0",
"items": "^2.0.0",
"vision": "^4.1.0"
},
"devDependencies": {
"babel-core": "^6.7.7",
"hapi": "^13.3.0",
"jade": "^1.11.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment