Skip to content

rcorral/hapi-restful-api-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Tasks API built using hapi v8.0

Build Status dependency Status devDependency Status

An example of a Restful API built using hapi.js v8.0 for storing a list of tasks.
Check out the demo.

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

About

An example of a restful api built using hapi.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published