restate
v0.7.12
Published
Framework for creating REST-based NodeJS applications with ease.
Downloads
19
Maintainers
Readme
restate
restate is a boilerplate aiding the creation of modern web applications enclosing client-side and server-side as well in a greatly configurable way.
It is just a possible way how to build-up a project covering all task you might deal with during a project's life cycle:
- well-structured project where every parts has decent and separated space covering server-side, clien-side, tests, reports, static elements, etc.
- highly modularized building scripts
- coding with the help of code coverage measurer and code error detector
- configurable server optionally preconfigured with security measurements, clustering, socketing, rest services, mongodb connectivity
- web development with livereload
- headless TDD or BDD testing phases
A straight-way proven completeness is more in focus than being X or Y lib-agnostic.
Involves technologies like:
- jade for templating
- stylus for CSS pre-processing
- connect-rest for rest services
- helmet for security
- authom for A&A
- socket.io for websockets
- mongoose for object modelling over mongodb
- knockoutJS for MVVM pattern
- gulp and really lots of addons / services for building processes
- mocha and chai for testing
- istambul.js for code coverage measurements
- browserify for client-side CommonJS modularity
- jshint for error detection
- testem headless test running
and a lots of other great goods you might need for a live enterprise-level project!
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 project projectName [--web] [--server] [--complete] [--noAA] [--noREST] [--noMongo] [--noKO] [--noWebsocket]
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
--web
Tells to restate to generate client-side code & tools.
--server
Tells to restate to generate server-side code & tools.
--complete
Tells to restate to generate client-, and server-side code & tools as well.
--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
[a specific 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 with the argument
--web
or
--complete
then you will have a web folder possessing 3 subfolders by default:
abstract, ad, workspace
The concept is simple. There is an abstract folder for generic definitions required 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.
While the concrete pages' folders (ad and workspace folders by default) are dedicated to define the specific and unique part of a given site.
Ad: could be a landing page. A static JADE-based page, reduced dependency-graph minimizing the loading time
Workspace: could be the workspace for your webapp. It is dynamic JADE site, so page is evaluated and compiled on the fly
As you can see in the ad folder for 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.
Adding a page
You can extend your [restate](https://github.com/imrefazekas/restate) project by a new page by executing the following:
restate page demo [--dynamic]
This will create a new page called "demo" and create the necessary gulp and test files as well similar to all preconfigured site you have by default.
The parameter --dynamic tells to restate to consider tha page as a dynamic one so build steps will presume on-the-fly compile activity.
Contribute or Request
Feel free to add requests to extend the capabilities of this utility!