UNPKG

makemehapi

Version:

Self guided workshops to teach you about hapi.

29 lines (24 loc) 537 B
const Path = require('path'); const Hapi = require('@hapi/hapi'); const Inert = require('@hapi/inert'); (async () => { try { const server = Hapi.Server({ host: 'localhost', port: process.argv[2] || 8080 }); await server.register(Inert); server.route({ path: '/foo/bar/baz/{filename}', method: 'GET', handler: { directory: { path: Path.join(__dirname, 'public') } } }); await server.start(); } catch (error) { console.log(error); } })();