Permalink
Browse files

Step 1.8: Add endpoints routes

  • Loading branch information...
DAB0mB committed Dec 12, 2016
1 parent a0a77ac commit 186a056ba33881976db9c4b37a4fa2ef741bee63
Showing with 80 additions and 0 deletions.
  1. +80 −0 routes/endpoints.js
@@ -0,0 +1,80 @@
const Pack = require("../package.json");

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

function register(server, options, next) {
// Scripts endpoint
server.route({
method: "GET",
path: "/scripts/{path*}",
handler: {
directory: {
path: "./resources/scripts/"
}
}
});

// Style-sheets endpoint
server.route({
method: "GET",
path: "/styles/{path*}",
handler: {
directory: {
path: "./resources/styles/"
}
}
});

// Libraries endpoint
server.route({
method: "GET",
path: "/libs/{path*}",
handler: {
directory: {
path: "./resources/libs/"
}
}
});

// Images endpoint
server.route({
method: "GET",
path: "/images/{path*}",
handler: {
directory: {
path: "./resources/images/"
}
}
});

// Textures endpoint
server.route({
method: "GET",
path: "/textures/{path*}",
handler: {
directory: {
path: "./resources/assets/textures/"
}
}
});

// Fonts endpoint
server.route({
method: "GET",
path: "/fonts/{path*}",
handler: {
directory: {
path: "./resources/assets/fonts/"
}
}
});

next();
}

module.exports = {
register
};

0 comments on commit 186a056

Please sign in to comment.