New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bfy-viceroy-rest-server

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

bfy-viceroy-rest-server

Viceroy REST Server contains middleware for express and [Viceroy] [1]. It allows you to create RESTful routes as well as custom routes based on your Viceroy Models.

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-90.91%
Maintainers
1
Weekly downloads
 
Created
Source

Viceroy-REST-Server

Viceroy REST Server contains middleware for express and [Viceroy] [1]. It allows you to create RESTful routes as well as custom routes based on your Viceroy Models.

Sample Code:

// modules
var util = require('util');
var connect = require('connect');
var viceroy = require('viceroy');
var viceroyNeDB = require('viceroy-nedb');

// libs
var viceroyRestServer = require('viceroy-rest-server');
var Model = viceroy.Model;

// create the web server
var app = connect();

// link up the viceroy driver
viceroy.driver(viceroyNeDB({
  databasePath: 'viceroy-rest-server-test'
}));

// create the viceroy rest server
var server = viceroyRestServer(app);
viceroy.use(server.middleware());

// load a people resource
server.loadRoutes(function(router) {
  // this creates the following routes for 'people':
  // create: POST /people
  // show: GET /people/:id
  // index: GET /people
  // update: PUT /people/:id
  // destroy: DELETE /people/:id
  router.resource('people');
});


// create and register the Persion model
function Person() {
  Model.apply(this, arguments);
}
util.inherits(Person, Model);
viceroy.model(Person);


// setup the db connection
viceroy.connect(function() {

  // bind the web server to port 8000
  app.listen(8000);
});


FAQs

Package last updated on 03 Sep 2014

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc