How to use the hapi.createServer function in hapi

To help you get started, we’ve selected a few hapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phase2 / pattern-lab-workshop / exercises / test_exercise / solution / solution.js View on Github external
var Hapi = require('hapi');
var path = require('path');

var server = Hapi.createServer('localhost', Number(process.argv[2] || 8080));
server.route({
    method: 'GET',
    path: '/',
    handler: {
        file: path.join(__dirname, '/index.html')
    }
});
server.start();
github rodrigo-medeiros / node-school-lessons / makemehapi / hello_hapi.js View on Github external
var Hapi = require("hapi");

var server = Hapi.createServer("localhost", Number(process.argv[2] || 8080));

server.route({
  method: 'GET',
  path: '/',
  handler: function (req, reply) {
    reply("Hello Hapi");
  }
});

server.start();
github rodrigo-medeiros / node-school-lessons / makemehapi / routes.js View on Github external
var Hapi = require("hapi");

var server = Hapi.createServer("localhost", Number(process.argv[2] || 8080));

server.route({
  method: 'GET',
  path: '/{name}',
  handler: function (request, reply) {
    reply("Hello " + request.params.name);
  }
});

server.start();
github rodrigo-medeiros / node-school-lessons / makemehapi / handling.js View on Github external
var Hapi = require('hapi'),
    path = require('path');

var server = Hapi.createServer("localhost", Number(process.argv[2] || 8080));

server.route({
  method: "GET",
  path: "/",
  handler: {
    file: path.join(__dirname, "/index.html")
  }
});

server.start();
github joyrexus / nodeschool / make-me-hapi / problems / hello_hapi / server.js View on Github external
'use strict';
var Hapi = require('hapi');
var server = Hapi.createServer('localhost', process.argv[2] || 8080);

server.route({
    method: 'GET',
    path: '/',
    handler: function (request, reply) { 
        reply('Hello Hapi'); 
    }
});

server.start();

hapi

HTTP Server framework

BSD-3-Clause
Latest version published 6 years ago

Package Health Score

40 / 100
Full package analysis