forked from tlivings/hapi-react-redux-ssr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
42 lines (31 loc) · 893 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 Configure from 'hapi-configure';
import Path from 'path';
import Routes from './lib/server_routes';
import Ejs from 'ejs';
const init = async function () {
const server = await Configure();
server.views({
engines: { ejs: Ejs },
relativeTo: __dirname,
path: '../lib'
});
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));