Code Monkey home page Code Monkey logo

seneca-jsonrest-api's Introduction

Seneca

A Seneca.js plugin to expose your data as REST API

seneca-jsonrest-api

Build Status Gitter

js-standard-style

  • Version: 0.3.1
  • Tested on: Seneca 0.7.1
  • Node: 0.10, 0.11, 0.12, 4

Exposes your data entities as a REST API. For example, if you have a data entity called foo, then the following end points will become available:

  • GET /api/rest/foo: return a list of all foo entities
  • GET /api/rest/foo/:id: return a single foo entity by identifier
  • POST /api/rest/foo: create a new foo entity
  • PUT /api/rest/foo/:id: update a foo entity

You can use the plugin options to change the URL prefix, and to add additional behaviours.

Note that it is not necessary for the underlying entity to be persistent. You can define a virtual entity foo by providing actions for the patterns:

  • role:entity,name:foo,cmd:save
  • role:entity,name:foo,cmd:load
  • role:entity,name:foo,cmd:list
  • role:entity,name:foo,cmd:remove

If you are new to Seneca in general, please take a look at senecajs.org. We have everything from tutorials to sample apps to help get you up and running quickly.

If you're using this module, and need help, you can:

Install

To install, simply use npm. Remember you will need to installSeneca.js if you haven't already.

npm install seneca
npm install seneca-jsonrest-api

Quick Example

require('seneca')()
  .use('jsonrest-api')

Options

You can seneca.use this plugin multiple times to create multiple independent API end points, so long as you specify different prefixes. The prefix option is used to create separate action patterns so that they do not conflict.

  • prefix: a custom prefix
  • pins: an array of entity pins, with properties name,base,zone. These define the data entities that will be exposed.

Examples

Contributing

The Senecajs org encourages open participation. If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.

License

Copyright Richard Rodger and other contributors 2015, Licensed under MIT.

seneca-jsonrest-api's People

Contributors

rjrodger avatar maxired avatar bamse16 avatar

Watchers

James Cloos avatar  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.