hapi-restful-api-example

1.0.2 • Public • Published

A Tasks API built using hapi

Build Status dependency Status devDependency Status

An example of a Restful API built using hapi.js for storing a list of tasks.

Install

$ git clone git@github.com:rcorral/hapi-restful-api-example.git
$ cd hapi-restful-api-example
$ npm install

Run

$ npm index.js

Using the API

Get tasks

$ curl -XGET http://localhost:8000/tasks

Get task by id

$ curl -XGET http://localhost:8000/tasks/{id}

Add tasks

$ curl -XPOST http://localhost:8000/tasks \
       -H 'Content-Type: application/json' \
       -d '{"task": "Play futbol."}'

Update task

$ curl -XPUT http://localhost:8000/tasks/{id} \
        -H 'Content-Type: application/json' \
        -d '{"task": "Play soccer."}'

Delete task

$ curl -XDELETE http://localhost:8000/tasks/{id}

Tests

$ npm test

License

MIT

Package Sidebar

Install

npm i hapi-restful-api-example

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • rcorral