BuildingRestfulAPIswith
HarvesterJS
Marcelo Cure
Marcelo Cure
Software Developer since 2007
Work at ilegra
Twitter: @__cure
WhatisHarvesterJS?
open-source library
Fork of FortuneJS
Build on the top of Express
Persistence (GET, POST, PUT, DELETE)
Lightweight
JSONAPICompliant
Specification for APIs
Defines standards for success/failure paylods
Defines standards to expose linked resources
Defines standards for querying
WhyJSONAPI?
Standard
Different APIs communicating in a common language
Saves developers’s time
Scary at first .. but it’s worth it
HTTPStatuses
http://http.cat/{statusCode}
Contracts
Easytocreateresources
Joi for describing and validating resources;
Contract validation by default;
Before and After persistency actions
Easytosetup
Just a few lines of code
Just a little configuration
Extensible
????
Easytocustomizeroutes
harvesterApp.router.get
harvesterApp.router.post
harvesterApp.router.put
harvesterApp.router.delete
Limitations
Cannot walk through a path like: /bands/123/albuns;
Mongo Oplog connection string required;
Resource with subdocument;
Production?
It’sOpenSource
References
https://github.com/agco/harvesterjs/
http://jsonapi.org/
https://github.com/hapijs/joi
https://expressjs.com/
http://http.cat/
Building restful ap is with harvester js

Building restful ap is with harvester js