ConnectAi / cs

Cornerstone, an es6 web framework built on express.js
13 stars 1 forks source link

Cornerstone

Web framework built on Node.js.

This node framework is a production-ready Node.js framework that takes advantage of ECMAScript 6 features through the use of 6to5. It is built on top of Express.

View the docs on controllers and views.

Requirements

Installation

The idea here is that you have your app in development on Git. Then you'll clone or deploy to your production server, and run CS in production mode.

Development

> npm install -g cs
> cs init {{appname}}
> npm install
> cs run

Production

See production docs.

Running

Development

> cd {{app dir}}
> cs run

Production

See production docs.

Config

config.json
{
    "name": "appname",
    "port": "8000",
    "session": "redis",
    "debug": false,
    "db": {
        "adapter": "mongodb",
        "mongodb" : {
            "host": "mongodb://localhost:27017/sixtyvocab"
        }
    },
    "env": {
        "production": {
            "port": 80
        },
        "development": {
            "debug": true
        }
    }
}

Directory Structure

./controllers
./models
./public
./private
./views
./services

Debugging

Utilities

Include

// include and compile a template
var compiledHTML = app.util.include("path/to/file")(data);

Services

Services are a way to share complete parts of CS that are just arbitrary functions.

Create a service

Sample service package.json for gmail service

{
    "name": "gmail",
    "version": "1.0.0",
    "description": "Gmail SMTP sending",
    "main": "gmail.js",
    "keywords": ["gmail","email","smtp"],
    "author": "ConnectAi",
    "license": "BSD-2-Clause",
    "dependencies": {
        "emailjs": "~0.3.5"
    }
}

Currently the services package.json don't do anything

ES6 Goodies

Read about the cool stuff ES6 can do you for you

Dictionary