1 | 'use strict'
|
2 |
|
3 | var Hapi = require('hapi')
|
4 |
|
5 |
|
6 | var server = new Hapi.Server()
|
7 | server.connection({
|
8 | host: 'localhost',
|
9 | port: 8080
|
10 | })
|
11 |
|
12 |
|
13 | server.route({
|
14 | method: 'GET',
|
15 | path: '/',
|
16 | handler: function (request, reply) {
|
17 | return reply('hello world')
|
18 | }
|
19 | })
|
20 |
|
21 | server.register(require('hapi-pino'), function (err) {
|
22 | if (err) {
|
23 | console.error(err)
|
24 | process.exit(1)
|
25 | }
|
26 |
|
27 |
|
28 | server.start(function (err) {
|
29 | if (err) {
|
30 | console.error(err)
|
31 | process.exit(1)
|
32 | }
|
33 | })
|
34 | })
|