MirzaAbazovic / playwithRESTHepi

Playing with REST using hepi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Playing with REST using hepi.js

Playing with REST using hepi Expoloring hepi REST by making simple project

  1. Creating server

var Hapi = require('hapi');
var server = new Hapi.Server();
server.connection({ port: 8080 });
server.start(function () {
    console.log('Server running at:', server.info.uri);
});
  1. Ading route

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

About

Playing with REST using hepi


Languages

Language:JavaScript 100.0%