0.8.31 • Published 3 years ago

baiji v0.8.31

Weekly downloads
48
License
MIT
Repository
github
Last release
3 years ago

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

0.8.30

3 years ago

0.8.31

3 years ago

0.8.29

3 years ago

0.8.28

3 years ago

0.8.27

4 years ago

0.8.26

4 years ago

0.8.25

6 years ago

0.8.24

6 years ago

0.8.23

6 years ago

0.8.22

6 years ago

0.8.21

6 years ago

0.8.20

6 years ago

0.8.19

6 years ago

0.8.18

7 years ago

0.8.17

7 years ago

0.8.16

7 years ago

0.8.15

7 years ago

0.8.14

7 years ago

0.8.13

7 years ago

0.8.12

7 years ago

0.8.11

7 years ago

0.8.10

7 years ago

0.8.9

7 years ago

0.8.8

7 years ago

0.8.7

7 years ago

0.8.6

7 years ago

0.8.5

7 years ago

0.8.4

7 years ago

0.8.3

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.12

7 years ago

0.7.11

7 years ago

0.7.10

7 years ago

0.7.9

7 years ago

0.7.8

7 years ago

0.7.7

7 years ago

0.7.6

7 years ago

0.7.5

7 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.2

8 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.6.6

8 years ago

0.6.5

8 years ago

0.6.4

8 years ago

0.6.3

8 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago