Skip to content

A simple REST API with hapi nodejs framework on top of a Apache Cassandra database

Notifications You must be signed in to change notification settings

saurasingh/hapi-cassandra

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#REST API on top of Cassandra database with hapi Nodejs framework

The goal of this project is to create a very simple REST API on top of Cassandra tables. In this example, services are created and used by users at a defined date. In coming versions there will be more Cassandra and DataStax Enterprise features like TTL and Spark usage. An interface is also planned to play with the API.

##Installation

##Using

  • Run HTTP Nodejs server

    $node server.js
    
  • Test the REST API

    • In command line with curl

    Create a service

    $curl -X POST -H "Content-Type: application/json" -d '{"title":"The best service"}' http://localhost:3000/service/create -i
    

    Add a user using this service

    $curl -X POST -H "Content-Type: application/json" -d '{"id":"d0f60aa8-54a9-4840-b70c-fe562b68842b","user":"victor"}' http://localhost:3000/service/user -i
    

    Get all users for a service

    $curl -X GET http://localhost:3000/service/d0f60aa8-54a9-4840-b70c-fe562b68842b -i
    

    Get all services

    $curl -X GET http://localhost:3000/services -i
    

    Delete a service

    $curl -X DELETE http://localhost:3000/service/delete/c391b62c-5e72-4e5d-ae74-6a5acd0a3ac3 -i
    

About

A simple REST API with hapi nodejs framework on top of a Apache Cassandra database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%