-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
42 lines (31 loc) · 932 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Steerage from 'steerage';
import Path from 'path';
import Routes from './lib/server/routes';
import Ejs from 'ejs';
const init = async function () {
const server = await Steerage({ config: Path.resolve('./config.json') });
server.views({
engines: { ejs: Ejs },
relativeTo: __dirname,
path: './lib/server'
});
server.route({
method: 'GET',
path: '/bundle.js',
handler: (request, reply) => {
reply.file(Path.join(__dirname, 'static/bundle.js'));
}
});
server.route({
method: 'GET',
path: '/styles.css',
handler: (request, reply) => {
reply.file(Path.join(__dirname, 'static/styles.css'));
}
});
Routes.init(server);
await server.start();
console.log('Server running at', server.info.uri);
return server;
};
init().catch((error) => console.error(error.stack));