KrakenJS

0 min read


Yah kembali lagi,, sekarang kita langsung ke KrakenJS ya guyss.. dimana fungsinya untuk membantu kita dalam develop express..

Give your node.js express apps some extra arms

https://krakenjs.com/#getting-started

Implementation

npm install -g yo generator-kraken bower grunt-cli
yo kraken
cd HelloWorld
npm start
> helloworld@0.1.0 start ~/HelloWorld
> node index.js

[development] Listening on http://localhost:8000

Structure of a Project

/config  
Application configuration including environment-specific configs

/controllers
Routes and logic

/locales
Language specific content bundles

/lib
Common libraries to be used across your app

/models
Models

/public
Web resources that are publicly available

/public/templates
Server and browser-side templates

/tasks
Grunt tasks to be automatically registered by [grunt-config-dir](https://github.com/logankoester/grunt-config-dir)

/tests
Unit and functional test cases

index.js
Application entry point

Example

index.js

'use strict';


var kraken = require('kraken-js'),
    app = require('express')(),
    options = {
        onconfig: function (config, next) {
            config.get('view engines:js:renderer:arguments').push(app);

            next(null, config);
        }
        /* more options are documented in the README */
    },
    port = process.env.PORT || 8000;


app.use(kraken(options));


app.listen(port, function (err) {
    console.log('[%s] Listening on http://localhost:%d', app.settings.env, port);
});

Bima Sena

Leave a Reply

Your email address will not be published. Required fields are marked *