Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

reqeuest body in hapijs

'use strict';

const Hapi = require('hapi');

const server = new Hapi.Server();
server.connection({
    host: 'localhost',
    port: 8000
});

server.route({
    method: 'POST',
    path:'/',
    handler: function (request, reply) {
        console.log(request.payload);
        console.log(request.raw.req.headers);
        return reply('hello world');
    },
    config: {
        payload: {
            output: 'data',
            parse: false
        }
    }
});

server.start((err) => {
    if (err) throw err;
    console.log('Server running at:', server.info.uri);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #reqeuest #body #hapijs
ADD COMMENT
Topic
Name
4+1 =