UNPKG

makemehapi

Version:

Self guided workshops to teach you about hapi.

23 lines (18 loc) 420 B
const Hapi = require('@hapi/hapi'); (async () => { try { const server = Hapi.Server({ host: 'localhost', port: Number(process.argv[2] || 8080) }); server.route({ path: '/', method: 'GET', handler: (request, h) => 'Hello hapi' }); await server.start(); console.log(`Server running at: ${server.info.uri}`); } catch (error) { console.log(error); } })();