Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deployd

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deployd

  • 0.3.0-alpha.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
64
increased by18.52%
Maintainers
1
Weekly downloads
 
Created
Source

deployd

Extensible, distributed, resource server.

features

  • Streaming, Any-Size File Storage
  • Queryable JSON Collections
  • Validation
  • Authentication
  • Proxy and Redirection
  • Extensible via Middleware

Installation

$ [sudo] npm install deployd -g

Starting / Stopping

You can start and stop the server with the dpd CLI. For more commands see dpd -h.

$ dpd listen

or the node module

var dpd = require('deployd')
  .use('http://localhost:3333')
  // optionally specify which storage resource to use
  // currently only mongodb is supported
  .storage('mongodb://localhost/my-dpd-storage')
  // tell deployd to listen
  .listen()
;

Client

The deployd api is entirely available over http. A basic http client is bundled.

var client = require('deployd').client.use('http://localhost:2304')
  , resources = client.use('/resources')
  , types = client.use('/types');

Node.js Module

The HTTP Client and node module api are the same.

var dpd = require('deployd').use('http://localhost:2304')
  , resources = dpd.use('/resources')
  , types = dpd.use('/types');

Types

types.get([query], [callback]) or /types will return a description of the available resource types.

Collections

Create a collection

Give the collection a URL and some validation and documents will only be inserted if they pass validation.

function done(err, collection) { ... }

resources.post({
  path: '/todos',
  type: 'Collection',
  settings: {
    title: {
      description: 'the title of the todo',
      type: 'string',
      required: true
    },
    completed: {
      description: 'the state of the todo',
      type: 'boolean',
      default: false
    }
  }
}, done);

Add a document to the collection

client.use('/todos').post({title: 'feed the dog'}, function(err, todo) {
  console.info(err || 'it worked! saved with _id', todo._id);
});

Users

Creating Users

Register a user by POSTing a valid user object to /users.

var user = {
  email: 'foo@bar.com',
  password: 'foobar'
};

client.use('/users').post(user, function(err, user) {
  console.info(err || 'registered user id: ' + user._id);
});

Login

Login a user by POSTing a valid credentials object to /users/login over HTTPS. Once a user is logged in (has created a session) all requests as the user must be made over HTTPS. Resources that do not require a user can still be made over HTTP.

var credentials = {email: 'foo@bar.com', password: 'foobar'};

client.use('/users/login').post(credentials, function(err, session) {
  console.info(err || 'logged in user id: ' + session.user._id);
});

Logout

Logout a user by making any request to /users/logout.

client.use('/users/logout').get(function(err) {
  console.info(err || 'logged out current user');
});

Deleting Users

Remove a user by sending a DELETE request to /users?_id=<user._id>.

client.use('/users').get({_id: user._id}).del(function(err) {
  console.info(err || 'deleted user id: ' + user._id);
});

Static Resources (Files)

POST, PUT, DELETE, and GET files over http. Only root authenticated or local requests (using the node module) are allowed to POST, PUT, or DELETE. All files are otherwise public.

FAQs

Package last updated on 14 Mar 2012

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