Socket
Socket
Sign inDemoInstall

destination

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

destination

Easiest API Framework Layer w/ Database agnostic ORM


Version published
Weekly downloads
7
increased by133.33%
Maintainers
1
Weekly downloads
 
Created
Source

Destination Framework

Painless API Creation Framework for Node.js w/ Database Agnostic Adapters.

Installation

npm install destination

Usage

Include the Destination Framework

var Destination = require('destination');

Install an Adapter, and start an objective:

var Objective = Destination.start(/* Express Application (app, generally) */, {
  name: 'adapter name such as (mongodb)',
  ... Adapter Settings ...
});

Start defining objective Models, Property schema curtesy of Validator.

var User = Objective.define('User', {
  // Definition is a collection?
  //
  // When collection is a string... it is used as the collection name 
  // rather than the name passed above.
  //
  // Example:
  //
  //     collection: 'users',
  //
  collection: true,

  // Routing System
  routing: {
    fetch: { by: 'name' },
    fetchAll: false,
    create: true,
    update: false,
    remove: false,
    
    // Some more complex, built in:
    
    // Update or Create
    upsert: false,
    
    // Remove all entries
    empty: false,
    
    // Count of all entries
    count: false
  },

  // Validator Schema
  name: {
    type: String,
    length: {
      min: 3,
      max: 24
    }
  },

  password: {
    type: String,
    length: {
      min: 3,
      max: 36
    }
  }
});

Models currently only have two keywords in the root document:

  • collection
  • routing

Anything else is used as a property schema, processed and parsed by Validator upon requests, refer to validator for schema documentation.

It's extremely simple. I promise. Now you listen:

Objective.listen(1337);

You don't even have to use the Objective variable to listen, you can use your application framework to do it and it will still work. :)

Adapters

Todo

  • Find a way to support any application framework instead of Express.

Keywords

FAQs

Package last updated on 09 Oct 2013

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