GithubHelp home page GithubHelp logo

sevr-rest's Introduction

sevr-rest

RESTful API Plugin for the Sevr Framework

Install

npm install --save sevr-rest

Usage

const rest = require('sevr-rest')

sevr.attach(rest, config)

API

Authorization

When authentication is enabled in Sevr, all requests will require authentication. There are two methods available for authenticating a request: Basic Auth and JWT.

Basic authentication requires the following HTTP header:

Authorization: Basic [CREDENTIALS]

[CREDENTIALS] is the user's username and password separated by a colon and base64 encoded.

JWT authentication requires the following HTTP header:

Authorization: Bearer [TOKEN]

[TOKEN] is the JSON Web TOKEN

To obtain a JWT, a request must first be made to /token, authenticating the request with Basic authentication.

Endpoints

CRUD Operations

Method Path Description
GET /collection/:coll Get all documents for a collection
GET /collection/:coll/:id Get a single document by id
GET /collection/:coll/:id/:field Get a single document field
POST /collection/:coll Create a new document
PUT /collection/:coll Update the documents in a collection
PUT /collection/:coll/:id Update a document by id
DELETE /collection/:coll Delete all documents in a collection
DELETE /collection/:coll/:id Delete a document by id

Other

Method Path Description
GET /definition/:coll Get the collection's definition
GET /token Get a JWT

Tests

npm test

License

This project is licensed under the MIT license.

sevr-rest's People

Contributors

dstreet avatar

Watchers

Brandon Powers avatar

Forkers

tgrowden

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.