Giter VIP home page Giter VIP logo

book-inventory's Introduction

This is a simple express app to CRUD on books

Endpoints:

GET / - Landing page
GET /books - Get all books
POST /books - Add a new book
DELETE /books/:isbn - Delete a book
PATCH /books/:isbn - Update a book
GET /search - Filter by attributes

Examples:

POST /books

curl -X POST -H "Content-Type: application/json"  \
-d '{
     "isbn": "1",            
     "copies": 100,
     "title": "this is title for new book",                  
     "subtitle": "this is subtitle for new book",                
     "author": "this is author for new book",  
     "published": "2014-12-14T00:00:00.000Z",
     "publisher": "this is publisher for new book",  
     "pages": 1234,
     "description": "this is description for new book",                                                                                                                                                                    
     "website": "http://eloquentjavascript.net/route/here/for/updated/website"
   }' \
"http://localhost:8080/books/"

PATCH /books/:isbn

curl -X PATCH -H "Content-Type: application/json"  \
-d '{
     "isbn": "9781491904244",
     "copies": 100,
     "title": "this is updated title",                 
     "subtitle": "this is updated subtitle",               
     "author": "this is updated author", 
     "published": "2014-12-14T00:00:00.000Z",
     "publisher": "this is updated publisher", 
     "pages": 1234,
     "description": "this is updated description",                                                                                                                                                                   
     "website": "http://eloquentjavascript.net/route/here/for/updated/website" 
   }' \
"http://localhost:8080/books/9781491904244"

DELETE /books/:isbn

curl -X DELETE http://localhost:8080/books/9781491904244
     -H "Accept: application/json"

GET /search

curl -d '{"key1":"value1", "key2":"value2"}' -H "ContentType: application/json" -X GET "http://localhost:8080/search?isbn=9781449331818"
curl -d '{"key1":"value1", "key2":"value2"}' -H "ContentType: application/json" -X GET "http://localhost:8080/search?author=Eric%20Elliott&publisher=O%27Reilly%20Media"

Build:

yarn install

yarn start

or with Docker

docker build -t book-inventory .

docker run -d -p 8080:8080 book-inventory

Test

yarn test

book-inventory's People

Contributors

ehabfeki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.