Socket
Book a DemoInstallSign in
Socket

repose

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

repose

A simple REST API that you can use when tinkering with front-end frameworks

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

Repose

A Simple REST API for tinkering with front-end frameworks

I like tinkering with front-end frameworks, and I found myself writing the same, simple REST API each time. It was always the thinnest possible server, but I didn't want to write it every time, so I packaged it up here.

Install

npm install repose

Usage

There's one function: repose. It needs a single parameter: the name of your API's model. It returns an express server object.

var repose = require('repose');

var app = repose('animals');

app.listen(3000);

This creates a server with the these routes:

  • GET /api/animals
  • GET /api/animals/<id>
  • POST /api/animals
  • PUT /api/animals/<id>
  • DELETE /api/animals/<id>

This will work perfectly with Backbone (et al.):

var Animals = Backbone.Collection.extend({
    url: '/api/animals'  
});

The Public Folder

A Repose "app" will serve the ./public directory by default. If you want to change that, pass the path as a second parameter (a relative path will do).

var app = repose('animals', './myPublicFolder');

TODO

Things I might do in the future:

  • add tests
  • use Node's native HTTP Server instead of Express
  • add options like preloading data and namespacing options

FAQs

Package last updated on 09 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.