Permalink
Browse files

Step 1.12: Add pages routes

  • Loading branch information...
DAB0mB committed Dec 12, 2016
1 parent 013be1a commit 14a6be0ed7e8c3159c53690f6dae3cde52953764
Showing with 35 additions and 0 deletions.
  1. +35 −0 routes/pages.js
@@ -0,0 +1,35 @@
const Hapi = require("hapi");
const Pack = require("../package.json");
const Permitter = require("../helpers/permitter");

register.attributes = {
name: "pages",
version: Pack.version
};

function register(server, options, next) {
server.route({ method: "GET", path: "/", handler: getGame });
server.route({ method: "GET", path: "/test", handler: getSpecRunner });

next();
}

// Serve game page
function getGame(req, rep) {
let path = "./views/game.html";
let permissions = [];

Permitter.file(path, permissions, req, rep);
}

// Serve test page
function getSpecRunner(req, rep) {
let path = "./views/spec_runner.html";
let permissions = [];

Permitter.file(path, permissions, req, rep);
}

module.exports = {
register
};

0 comments on commit 14a6be0

Please sign in to comment.