(DEPRECIATED) A Rails-inspired Express framework for Node
A modular Express framework for Node. Integrates the following libraries and features:
Make GCE ORM agnostic (able to use GCR, sequelize, JugglingDB)
Create 'mincer' branch to replace GCP (both?)
Testing for command-line interface
Testing for Express integration
Use glob for getting Models
When creating new app, don't overwrite package.json (extend it with required extras)
Use layouts in views/EJS rendering <%= yield %> (use mincer)
gce new APP_NAME
Generates new app scaffolding.
# Make sure you're in the project folder already$ mkdir project$ cd project$ gce new project
gce server | s | start | run
Starts Express server on port 3000. Use the -p option to change ports, and the -e option to change environments.
$ gce serverGrand Central Express server listening on port 3000
gce generate controller NAME [action action]
Generates a controller and associated routes with provided actions.
$ gce generate controller Company about team contactcreate controller/company.js
gce generate model NAME [field:type field:type]
Generates a model with provided attributes.
$ gce generate model book title:string author:stringcreate models/Book.js
gce generate scaffold NAME [field:type field:type]
Generates a model with provided attributes and a RESTful JSON controller. Also generates client-side Backbone model & collection. The actions currently don't include update or destroy. These are coming once the custom ORM is built.
Pass -c to avoid creating Backbone scaffold.
$ gce generate scaffold animal name:string species:string -ccreate models/Animal.jscreate controllers/animal.jsupdate routes
gce [backbone | bb] [scaffold | model] NAME [field:type field:type]
Generates Backbone model and collection for given name and fields.
$ gce bb scaffold animal name:string species:stringcreate client/models/Animal.jscreate client/collections/animalList.js
gce [backbone | bb] view NAME
Generates Backbone view.
$ gce bb view itemcreate client/views/itemView.js
[Not currently functional] Migrates and syncs your model schemas to the database. Use the -e option to change database environments.
gce version | v | -v
Gets your version of Grand Central Express.### Router
See Grand Central Junction. Default routes file is
/config/routes.js, default controllers path is
Defined in the
/models folder, with capitalized names like
Person.js. The model is defined like so:
var Model = require'grand-central-express'Model;moduleexports =name: "Person"schema:name: Stringemail: Stringadmin: Booleanrank: Number;
Methods, validations and relationships are still in development.
Models are accessed in controllers:
var id = reqparam'id';modelsPersonfindidif err throw err;resjsonperson;;;
Database connections are defined in
config/db.json. For whatever database you use, make sure to include the package (mysql, pg, sqlite3) in your dependencies.
The template defaults to using SQLite3 files for both development and production.