fist

3.6.2 • Public • Published

fist the framework Build Status

Fist is a nodejs framework designed to help create scalable server applications.

What do I get?

Plugin system

Modular application structure. Automatic project files loading.

fist_plugins/
    models/
        user.info.js
        news.list.js
        news.available_list.js
    controllers/
        news_page.js
Loosely coupled architecture

Focus on unit development. Encapsulated business logic.

app.unit({
    name: 'news.available_list',
    deps: ['news.list', 'user.info'],
Data models

Simple and intuitive data structures. Unobtrusive data typing.

{
    errors: {},
    result: {
        news: {
            available_list: [
                {
                    type: "post",
                    visibility: "all",
Thin controllers

Just check that your models are valid.

app.unit({
    name: 'news_page',
    deps: ['news.available_list'],
    main: function (track, context) {
        if (context.e('news.available_list')) {
            track.status(500).send();
Built-in logging tools

Always clear what happening and where. More reliability.

app.unit({
    name: 'user.info',
    main: function (track, context) {
        context.logger.debug('Checking user by sessid\n"%s"', track.cookie('sessid'));
Built-in cache

Just specify what parts of your program can be cached. Less loading. More responsiveness.

app.unit({
    name: 'news.list',
    maxAge: 5000,

Hello, world!

$ npm install fist

app.js:

var fist = require('fist');
var app = fist();
app.listen(1337);

fist_plugins/routes.js:

module.exports = function (app) {
    app.route('GET /hello/(<name>/)', 'hello_page');
};

fist_plugins/controllers/hello_page.js:

module.exports = function (app) {
    app.unit({
        name: 'hello_page',
        deps: ['greeting_data'],
        main: function (track, context) {
            track.send(context.r('greeting_data.helloText'));
        }
    });
};

fist_plugins/models/greeting_data.js:

module.exports = function (app) {
    app.unit({
        name: 'greeting_data',
        main: function (track, context) {
            return {
                helloText: 'Hello, ' + context.p('name')
            };
        },
        params: {
            name: 'what is your name?'
        }
    });
};
$ node app.js

See the full example code

Quick start

Docs


LICENSE MIT

Readme

Keywords

none

Package Sidebar

Install

npm i fist

Weekly Downloads

23

Version

3.6.2

License

MIT

Last publish

Collaborators

  • golyshevd