Skip to content

Commit 186a056

Browse files
committed
Step 1.8: Add endpoints routes
1 parent a0a77ac commit 186a056

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

routes/endpoints.js

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
const Pack = require("../package.json");
2+
3+
register.attributes = {
4+
name: "endpoints",
5+
version: Pack.version
6+
};
7+
8+
function register(server, options, next) {
9+
// Scripts endpoint
10+
server.route({
11+
method: "GET",
12+
path: "/scripts/{path*}",
13+
handler: {
14+
directory: {
15+
path: "./resources/scripts/"
16+
}
17+
}
18+
});
19+
20+
// Style-sheets endpoint
21+
server.route({
22+
method: "GET",
23+
path: "/styles/{path*}",
24+
handler: {
25+
directory: {
26+
path: "./resources/styles/"
27+
}
28+
}
29+
});
30+
31+
// Libraries endpoint
32+
server.route({
33+
method: "GET",
34+
path: "/libs/{path*}",
35+
handler: {
36+
directory: {
37+
path: "./resources/libs/"
38+
}
39+
}
40+
});
41+
42+
// Images endpoint
43+
server.route({
44+
method: "GET",
45+
path: "/images/{path*}",
46+
handler: {
47+
directory: {
48+
path: "./resources/images/"
49+
}
50+
}
51+
});
52+
53+
// Textures endpoint
54+
server.route({
55+
method: "GET",
56+
path: "/textures/{path*}",
57+
handler: {
58+
directory: {
59+
path: "./resources/assets/textures/"
60+
}
61+
}
62+
});
63+
64+
// Fonts endpoint
65+
server.route({
66+
method: "GET",
67+
path: "/fonts/{path*}",
68+
handler: {
69+
directory: {
70+
path: "./resources/assets/fonts/"
71+
}
72+
}
73+
});
74+
75+
next();
76+
}
77+
78+
module.exports = {
79+
register
80+
};

0 commit comments

Comments
 (0)