Giter VIP home page Giter VIP logo

json-api-server-example's Introduction

json-api-server-example

Build Status

An example JSON API server using Postgres and Express

Created to help me learn the JSON API format. It uses the MassiveJS library to access a Postgres database.

Installation

npm install

Usage

You'll need Postgres to be installed and running. You can then setup the database:

npm run setup-database

Start the server:

npm start

This will start a server running at http://127.0.0.1:3000.

Features

The API implements the basic CRUD actions for a single collection:

  • GET /people
  • POST /people
  • GET /people/:id
  • PATCH /people/:id
  • DELETE /people/:id

Sorting

The GET /people route supports sorting as described in the sorting specification. Multiple sort fields can be used together:

GET /people?sort=surname,-name HTTP/1.1

Pagination

Page-based pagination is implemented as per the pagination specification:

GET /people?page[number]=2&page[size]=1 HTTP/1.1

Filtering

The filter parameter can be used to filter records as described in the recommendations for filtering:

GET /people?filter[name]=Ron&filter[surname]=Weasley HTTP/1.1

json-api-server-example's People

Contributors

robinjmurphy avatar

Watchers

 avatar  avatar  avatar

json-api-server-example's Issues

Implement strict content negotiation

See: http://jsonapi.org/format/#content-negotiation-servers.

Servers MUST respond with a 415 Unsupported Media Type status code if a request specifies the header Content-Type: application/vnd.api+json with any media type parameters.

Servers MUST respond with a 406 Not Acceptable status code if a request's Accept header contains the JSON API media type and all instances of that media type are modified with media type parameters.

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.