File tree Expand file tree Collapse file tree 3 files changed +15
-42
lines changed Expand file tree Collapse file tree 3 files changed +15
-42
lines changed Original file line number Diff line number Diff line change 22
33const Hapi = require ( 'hapi' )
44
5- // create new server instance
6- // add server’s connection information
7- const server = new Hapi . Server ( {
8- host : 'localhost' ,
9- port : 3000
10- } )
5+ const server = new Hapi . Server ( { host : 'localhost' , port : 3000 } )
116
127async function launchIt ( ) {
138 await server . register ( {
@@ -18,19 +13,15 @@ async function launchIt () {
1813 } )
1914
2015 server . route ( {
21- method : 'GET ' ,
16+ method : '* ' ,
2217 path : '/{path*}' ,
23- handler : ( request , h ) => {
18+ handler : ( _ , h ) => {
2419 return h . notAvailable ( )
2520 }
2621 } )
2722
28- try {
29- await server . start ( )
30- console . log ( 'Server running at: ' + server . info . uri )
31- } catch ( err ) {
32- throw err
33- }
23+ await server . start ( )
24+ console . log ( 'Server running at: ' + server . info . uri )
3425}
3526
3627launchIt ( )
Original file line number Diff line number Diff line change 33const Hapi = require ( 'hapi' )
44const Path = require ( 'path' )
55
6- // create new server instance
7- // add server’s connection information
8- const server = new Hapi . Server ( {
9- host : 'localhost' ,
10- port : 3000
11- } )
6+ const server = new Hapi . Server ( { host : 'localhost' , port : 3000 } )
127
138async function launchIt ( ) {
149 await server . register ( [
@@ -34,19 +29,15 @@ async function launchIt () {
3429 } )
3530
3631 server . route ( {
37- method : 'GET ' ,
32+ method : '* ' ,
3833 path : '/{path*}' ,
39- handler : ( request , reply ) => {
34+ handler : ( _ , reply ) => {
4035 reply . notAvailable ( )
4136 }
4237 } )
4338
44- try {
45- await server . start ( )
46- console . log ( 'Server running at: ' + server . info . uri )
47- } catch ( err ) {
48- throw err
49- }
39+ await server . start ( )
40+ console . log ( 'Server running at: ' + server . info . uri )
5041}
5142
5243launchIt ( )
Original file line number Diff line number Diff line change 22
33const Hapi = require ( 'hapi' )
44
5- // create new server instance
6- // add server’s connection information
7- const server = new Hapi . Server ( {
8- host : 'localhost' ,
9- port : 3000
10- } )
5+ const server = new Hapi . Server ( { host : 'localhost' , port : 3000 } )
116
127async function launchIt ( ) {
138 await server . register ( {
@@ -18,7 +13,7 @@ async function launchIt () {
1813 links : [
1914 ( error ) => {
2015 return `<a rel="noopener noreferrer" target="_blank" href="https://github.com/fs-opensource/hapi-dev-errors/search?q=${ error . message } ">
21- Search on GitHub
16+ Search hapi-dev-errors on GitHub
2217 </a>`
2318 }
2419 ]
@@ -28,17 +23,13 @@ async function launchIt () {
2823 server . route ( {
2924 method : 'GET' ,
3025 path : '/{path*}' ,
31- handler : ( request , h ) => {
26+ handler : ( _ , h ) => {
3227 h . notAvailable ( )
3328 }
3429 } )
3530
36- try {
37- await server . start ( )
38- console . log ( 'Server running at: ' + server . info . uri )
39- } catch ( err ) {
40- throw err
41- }
31+ await server . start ( )
32+ console . log ( 'Server running at: ' + server . info . uri )
4233}
4334
4435launchIt ( )
You can’t perform that action at this time.
0 commit comments