baiji
Baiji is an easy to use and opinionated micro-framework for writing scalable and REST-like web APIs. Its main goals are parameter validation, entities, hooks, scalability and allowing rapid development and deployment of such APIs.
Last updated 2 months ago by lyfeyaj .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install baiji 
SYNC missed versions from official npm registry.

Baiji (白鱀豚 ????)

Build Status

Bring the ????(beauty) back to life.

Baiji is an easy to use and opinionated micro-framework for writing scalable and REST-like web applications.

Baiji is an ideal candidate for building robust, scalable and secure web things.

Features

  • Adapters support: Express, Socket.io, more supports will comming soon
  • Hooks, enabling the power of scalability of your api method
  • Modern Controller syntax
  • Smart routes sorter
  • Sweet debug info
  • Built-in parameter filter
  • Entities - a simple Facade to use with your models and API

Basic Use Case Preview

Using ES6 Syntax

const baiji = require('baiji');
const app = baiji('my-example-app');

class UsersCtrl extends baiji.Controller {
  constructor() {
    super();
    // Use before actions
    this.beforeAction('signInRequired');
  }

  initConfig() {
    return {
      search: {
        description: 'Search users...',
        route: { path: '/', verb: 'get' }
      }
    }
  }

  signInRequired(ctx, next) {
    if (ctx.state.isSignedIn()) return next();
    ctx.done({ error: 'Unauthorized' });
  }

  search(ctx, next) {
    ctx.done([{ username: 'lyfeyaj', gender: 1 }], next);
  }
}

// Use express middleware: response-time
app.use(require('response-time')());
// Use express middleware: cookie-parser
app.use(require('cookie-parser')());

// Use controller
app.use(UsersCtrl);

// Start app and listen on port 3000
app.listen(3000);

TODOs

  • Add RPC support

License

Current Tags

  • 0.8.27                                ...           latest (a month ago)

54 Versions

  • 0.8.27                                ...           a month ago
  • 0.8.26                                ...           2 months ago
  • 0.8.25                                ...           3 years ago
  • 0.8.24                                ...           3 years ago
  • 0.8.23                                ...           3 years ago
  • 0.8.22                                ...           3 years ago
  • 0.8.21                                ...           3 years ago
  • 0.8.20                                ...           3 years ago
  • 0.8.19                                ...           3 years ago
  • 0.8.18                                ...           3 years ago
  • 0.8.17                                ...           3 years ago
  • 0.8.16                                ...           3 years ago
  • 0.8.15                                ...           3 years ago
  • 0.8.14                                ...           3 years ago
  • 0.8.13                                ...           3 years ago
  • 0.8.12                                ...           3 years ago
  • 0.8.11                                ...           3 years ago
  • 0.8.10                                ...           3 years ago
  • 0.8.9                                ...           3 years ago
  • 0.8.8                                ...           3 years ago
  • 0.8.7                                ...           3 years ago
  • 0.8.6                                ...           3 years ago
  • 0.8.5                                ...           3 years ago
  • 0.8.4                                ...           3 years ago
  • 0.8.3                                ...           3 years ago
  • 0.8.2                                ...           3 years ago
  • 0.8.1                                ...           3 years ago
  • 0.8.0                                ...           4 years ago
  • 0.7.12                                ...           4 years ago
  • 0.7.11                                ...           4 years ago
  • 0.7.10                                ...           4 years ago
  • 0.7.9                                ...           4 years ago
  • 0.7.8                                ...           4 years ago
  • 0.7.7                                ...           4 years ago
  • 0.7.6                                ...           4 years ago
  • 0.7.5                                ...           4 years ago
  • 0.7.4                                ...           4 years ago
  • 0.7.3                                ...           4 years ago
  • 0.7.2                                ...           4 years ago
  • 0.7.1                                ...           4 years ago
  • 0.7.0                                ...           4 years ago
  • 0.6.6                                ...           4 years ago
  • 0.6.5                                ...           4 years ago
  • 0.6.4                                ...           4 years ago
  • 0.6.3                                ...           4 years ago
  • 0.6.2                                ...           4 years ago
  • 0.6.1                                ...           4 years ago
  • 0.6.0                                ...           4 years ago
  • 0.5.1                                ...           4 years ago
  • 0.5.0                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 30
Dependencies (17)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |