ndx-server
my server framework
Last updated 14 days ago by ndxbxrme .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ndx-server 
SYNC missed versions from official npm registry.

ndx-server

A lightweight, robust, modular server built on Express and Alasql

Features

  • No need for a database server
  • Persists to S3 with as few reads and writes as possible
  • Sessionless tokens can withstand a server restart
  • Scale servers easily using ndx-sync
  • Schemaless SQL database which treats javascript objects as first class citizens

npm install --save ndx-server

var ndx = require('ndx-server');

Example

  var ndx = require('ndx-server')
  .config({
    database: 'rb',
    tables: ['users', 'tasks'],
    port: 23000
  })
  .controller(function(ndx) {
    ndx.app.get('/api/thing', function(req, res) {
      res.json({
        hey: 'yo'
      });
    });
  })
  .start();

Methods

ndx.config(object args) -> ndx

Configure the server

ndx.controller(function controller) -> ndx

Register a controller

ndx.controller(function(ndx) {
  //use the ndx controller
  //register some routes etc
});
ndx.controller(require('./controllers/my-controller'));
ndx.controller('npm-module');

ndx.use(function controller) -> ndx

Register a service

ndx.use(function(ndx) {
  //use the ndx service
  //register some routes etc
});
ndx.use(require('./services/my-service'));
ndx.use('npm-module');

all modules from the folders /startup, /services and /controllers now get auto-loaded so you no longer need to reference them

ndx.start()

Start the server

the ndx object

The ndx object gets passed to each controller and service

Properties

  • ndx.app - The express app
  • ndx.server - The express server
  • ndx.database - The database
  • ndx.settings - Server settings
  • ndx.host - Server host
  • ndx.port - Server port

Methods

  • ndx.generateHash(string) -> hashed string
  • ndx.validPassword(password, hashedPassword) -> bool
  • ndx.authenticate() middleware to authenticate a route, see ndx-user-roles for a more robust implementation
  • ndx.postAuthenticate(req, res, next) used internally
  • ndx.generateToken(string userId, string ip) -> new user token
  • ndx.setAuthCookie(req, res) used internally

other modules can add extra properties and methods to the ndx object, eg ndx-passport which adds ndx.passport for the other passport modules to use.

all ndx modules get auto-loaded by default, so all you need to do is npm install them

modules

ndx-framework

Use the ndx-framework app to quickly create, connect to and configure ndx-server apps

Current Tags

  • 0.18.1                                ...           latest (14 days ago)

211 Versions

  • 0.18.1                                ...           14 days ago
  • 0.18.0                                ...           14 days ago
  • 0.17.1                                ...           a month ago
  • 0.17.0                                ...           a month ago
  • 0.16.12                                ...           6 months ago
  • 0.16.11                                ...           a year ago
  • 0.16.10                                ...           a year ago
  • 0.16.9                                ...           a year ago
  • 0.16.8                                ...           a year ago
  • 0.16.7                                ...           a year ago
  • 0.16.6                                ...           a year ago
  • 0.16.5                                ...           a year ago
  • 0.16.3                                ...           a year ago
  • 0.16.2                                ...           a year ago
  • 0.16.1                                ...           a year ago
  • 0.16.0                                ...           a year ago
  • 0.15.18                                ...           a year ago
  • 0.15.17                                ...           a year ago
  • 0.15.16                                ...           a year ago
  • 0.15.15                                ...           a year ago
  • 0.15.13                                ...           a year ago
  • 0.15.14                                ...           a year ago
  • 0.15.12                                ...           a year ago
  • 0.15.11                                ...           2 years ago
  • 0.15.10                                ...           2 years ago
  • 0.15.9                                ...           2 years ago
  • 0.15.8                                ...           2 years ago
  • 0.15.7                                ...           2 years ago
  • 0.15.6                                ...           2 years ago
  • 0.15.5                                ...           2 years ago
  • 0.15.4                                ...           2 years ago
  • 0.15.3                                ...           2 years ago
  • 0.15.2                                ...           2 years ago
  • 0.15.1                                ...           2 years ago
  • 0.15.0                                ...           2 years ago
  • 0.14.0                                ...           2 years ago
  • 0.13.28                                ...           2 years ago
  • 0.13.27                                ...           2 years ago
  • 0.13.26                                ...           2 years ago
  • 0.13.25                                ...           2 years ago
  • 0.13.24                                ...           2 years ago
  • 0.13.23                                ...           2 years ago
  • 0.13.22                                ...           2 years ago
  • 0.13.21                                ...           2 years ago
  • 0.13.20                                ...           2 years ago
  • 0.13.19                                ...           2 years ago
  • 0.13.18                                ...           2 years ago
  • 0.13.17                                ...           2 years ago
  • 0.13.16                                ...           2 years ago
  • 0.13.15                                ...           2 years ago
  • 0.13.14                                ...           2 years ago
  • 0.13.13                                ...           2 years ago
  • 0.13.12                                ...           2 years ago
  • 0.13.11                                ...           2 years ago
  • 0.13.10                                ...           2 years ago
  • 0.13.9                                ...           2 years ago
  • 0.13.8                                ...           2 years ago
  • 0.13.7                                ...           2 years ago
  • 0.13.6                                ...           2 years ago
  • 0.13.5                                ...           2 years ago
  • 0.13.4                                ...           2 years ago
  • 0.13.3                                ...           2 years ago
  • 0.13.2                                ...           2 years ago
  • 0.13.1                                ...           2 years ago
  • 0.13.0                                ...           2 years ago
  • 0.12.12                                ...           2 years ago
  • 0.12.11                                ...           2 years ago
  • 0.12.10                                ...           2 years ago
  • 0.12.9                                ...           2 years ago
  • 0.12.8                                ...           2 years ago
  • 0.12.7                                ...           2 years ago
  • 0.12.6                                ...           2 years ago
  • 0.12.5                                ...           2 years ago
  • 0.12.4                                ...           3 years ago
  • 0.12.3                                ...           3 years ago
  • 0.12.2                                ...           3 years ago
  • 0.12.1                                ...           3 years ago
  • 0.12.0                                ...           3 years ago
  • 0.11.0                                ...           3 years ago
  • 0.10.6                                ...           3 years ago
  • 0.10.5                                ...           3 years ago
  • 0.10.4                                ...           3 years ago
  • 0.10.3                                ...           3 years ago
  • 0.10.2                                ...           3 years ago
  • 0.10.1                                ...           3 years ago
  • 0.10.0                                ...           3 years ago
  • 0.9.9                                ...           3 years ago
  • 0.9.8                                ...           3 years ago
  • 0.9.7                                ...           3 years ago
  • 0.9.6                                ...           3 years ago
  • 0.9.5                                ...           3 years ago
  • 0.9.4                                ...           3 years ago
  • 0.9.3                                ...           3 years ago
  • 0.9.2                                ...           3 years ago
  • 0.9.1                                ...           3 years ago
  • 0.9.0                                ...           3 years ago
  • 0.8.2                                ...           3 years ago
  • 0.8.1                                ...           3 years ago
  • 0.8.0                                ...           3 years ago
  • 0.7.5                                ...           3 years ago
  • 0.7.4                                ...           3 years ago
  • 0.7.3                                ...           3 years ago
  • 0.7.2                                ...           3 years ago
  • 0.7.1                                ...           3 years ago
  • 0.7.0                                ...           3 years ago
  • 0.6.1                                ...           3 years ago
  • 0.6.0                                ...           3 years ago
  • 0.5.24                                ...           3 years ago
  • 0.5.23                                ...           3 years ago
  • 0.5.22                                ...           3 years ago
  • 0.5.21                                ...           3 years ago
  • 0.5.20                                ...           3 years ago
  • 0.5.19                                ...           3 years ago
  • 0.5.18                                ...           3 years ago
  • 0.5.17                                ...           3 years ago
  • 0.5.16                                ...           3 years ago
  • 0.5.15                                ...           3 years ago
  • 0.5.14                                ...           3 years ago
  • 0.5.13                                ...           3 years ago
  • 0.5.12                                ...           3 years ago
  • 0.5.11                                ...           3 years ago
  • 0.5.10                                ...           3 years ago
  • 0.5.9                                ...           3 years ago
  • 0.5.8                                ...           3 years ago
  • 0.5.7                                ...           3 years ago
  • 0.5.6                                ...           3 years ago
  • 0.5.5                                ...           3 years ago
  • 0.5.4                                ...           3 years ago
  • 0.5.3                                ...           3 years ago
  • 0.5.2                                ...           3 years ago
  • 0.5.1                                ...           3 years ago
  • 0.5.0                                ...           3 years ago
  • 0.4.17                                ...           3 years ago
  • 0.4.16                                ...           3 years ago
  • 0.4.15                                ...           3 years ago
  • 0.4.14                                ...           3 years ago
  • 0.4.13                                ...           3 years ago
  • 0.4.12                                ...           3 years ago
  • 0.4.11                                ...           3 years ago
  • 0.4.10                                ...           3 years ago
  • 0.4.9                                ...           3 years ago
  • 0.4.8                                ...           3 years ago
  • 0.4.7                                ...           3 years ago
  • 0.4.6                                ...           3 years ago
  • 0.4.5                                ...           3 years ago
  • 0.4.4                                ...           3 years ago
  • 0.4.3                                ...           3 years ago
  • 0.4.2                                ...           3 years ago
  • 0.4.1                                ...           3 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.39                                ...           3 years ago
  • 0.2.38                                ...           3 years ago
  • 0.2.37                                ...           3 years ago
  • 0.2.36                                ...           3 years ago
  • 0.2.35                                ...           3 years ago
  • 0.2.34                                ...           3 years ago
  • 0.2.33                                ...           3 years ago
  • 0.2.32                                ...           3 years ago
  • 0.2.31                                ...           3 years ago
  • 0.2.30                                ...           3 years ago
  • 0.2.29                                ...           3 years ago
  • 0.2.28                                ...           3 years ago
  • 0.2.27                                ...           3 years ago
  • 0.2.26                                ...           3 years ago
  • 0.2.25                                ...           3 years ago
  • 0.2.24                                ...           3 years ago
  • 0.2.23                                ...           3 years ago
  • 0.2.22                                ...           3 years ago
  • 0.2.21                                ...           3 years ago
  • 0.2.20                                ...           3 years ago
  • 0.2.19                                ...           3 years ago
  • 0.2.18                                ...           3 years ago
  • 0.2.17                                ...           3 years ago
  • 0.2.16                                ...           3 years ago
  • 0.2.15                                ...           3 years ago
  • 0.2.14                                ...           3 years ago
  • 0.2.13                                ...           3 years ago
  • 0.2.12                                ...           3 years ago
  • 0.2.11                                ...           3 years ago
  • 0.2.10                                ...           3 years ago
  • 0.2.9                                ...           3 years ago
  • 0.2.8                                ...           3 years ago
  • 0.2.7                                ...           3 years ago
  • 0.2.6                                ...           3 years ago
  • 0.2.5                                ...           3 years ago
  • 0.2.4                                ...           3 years ago
  • 0.2.3                                ...           3 years ago
  • 0.2.2                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.14                                ...           3 years ago
  • 0.1.13                                ...           3 years ago
  • 0.1.12                                ...           3 years ago
  • 0.1.11                                ...           3 years ago
  • 0.1.10                                ...           3 years ago
  • 0.1.9                                ...           3 years ago
  • 0.1.8                                ...           3 years ago
  • 0.1.7                                ...           3 years ago
  • 0.1.6                                ...           3 years ago
  • 0.1.5                                ...           3 years ago
  • 0.1.4                                ...           3 years ago
  • 0.1.3                                ...           3 years ago
  • 0.1.2                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 54
Last Day 0
Last Week 0
Last Month 36
Dependencies (19)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |