restate

Framework for creating REST-based NodeJS applications with ease.

npm install restate
54 downloads in the last day
63 downloads in the last week
76 downloads in the last month

restate

restate is a simple framework aiding the creation of REST-based nodejs applications.

Just a quick generator for projects using technologies: connect, jade, less and connect-rest; using libraries like socket.io, mongoose or knockoutJS.

Generates everything you need: build files, ready-to-serve server code, project folder structure, basic deployment stage-levels

The server-side code is already clustered using NodeJS's cluster. Main script is:

server / cluster.js

The generated project is ready to abstract layouts, styles, JS code and inherit/share it to multiple sites if needed. See for details below.

Installation

$ npm install -g restate

Usage

Step into a folder where you want to create your new project folder and execute the following from command line:

$ restate projectName [--preserveFiles] [--noAA] [--noREST] [--noMongo] [--noKO]

This will create the project structure and scripts for it allowing you to build into 2 different stages: development and production.

restate finishes in an instant and you are ready to go! (have a running local mongo!)

$ ./buildDevelopment.sh

And open browser:

http://localhost:8080/

Done. :)

Configuration

--noWeb
Keeps the project server-side only without any less-css-js-jade components including build steps

--preserveFiles
Will try not to override any existing files.

--noAA
Removes the built-in A&A tempalte code from the server-side.

--noREST
Removes the built-in RESTful tempalte code from the server-side.

--noMongo
Removes the built-in MongoDB tempalte code from the services-side

--noKO
Removes the built-in Knockout.js tempalte code from the client-side

--noWebsocket
Removes the built-in Websocket tempalte code from the services-side

Project structure

.gitignore --- usual
buildDevelopment.sh --- shorthand for gruntRun.sh
buildProduction.sh --- shorthand for gruntRun.sh
config/ --- json config files configuring server and db connectivity
Gruntfile.js --- grunt file and plugins
gruntRun.sh --- runs grunt with a parameter specifying the stage level
package.json --- usual
server/ --- js files of the server. RESTful services, connect server, A&A services, Mongo connectivity
web/ --- dynamic web files
    abstract
        less/ --- folder for less files
        js/  --- folder for the js files
            lib/  --- folder for the external js files
        views/  --- folder for the jade files
    site
        less/ --- folder for less files
        js/  --- folder for the js files
            lib/  --- folder for the external js files
        views/  --- folder for the jade files
www/ --- static files' folder

Every build will be put into the created 'dist' folder.

Multiple pages

If your project is created without the argument

--noWeb

then you will have a web folder possessing 2 subfolders by default:

abstract and site

The concept is simple. There is an abstract folder for generic definitions inherited by all sites, and as many specific folder as you want to build up.

The abstract folder contains all less, js or jade files which should be inherited across the concrete sites you want to build up.

While the concrete pages' folders (site folder by default) are dedicated to defines the specific and unique part of a given site.

As you can see in the site folder example, you can inherit anything you need from the abstract folder keeping project maintainability at high level when multiple sites need to be built up and managed.

Contribute or Request

Feel free to add requests to extend the capabilities of this utility!

npm loves you