npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grand-central-express

v0.1.3

Published

(DEPRECIATED) A Rails-inspired Express framework for Node

Downloads

12

Readme

DEPRECIATED

Only the following 'spin-offs' are updated:

  • Grand Central Junction -- a simple Rails-inspired router built on top of Express.
  • Grand Central Records -- a promise-based Node ORM/ActiveRecord library that can connect to MySQL, Postgres, and SQLite3. Allows chainable, raw or queueable queries.

(OLD) Grand Central Express

A modular Express framework for Node. Integrates the following libraries and features:

  • Grand Central Junction -- a simple Rails-inspired router built on top of Express.
  • Grand Central Pipeline -- an asset pipeline designed specifically for javascript concatenation and minimization.
  • Command-line scaffold generator --
  • Uses ejs view engine and LESS CSS compiling
  • Uses Backbone.js for front-end framework
  • ORM integration with either Grand Central Records, JugglingDB, or Node-ORM.

TODO

  • Make GCE ORM agnostic (able to use GCR, sequelize, JugglingDB)

  • Create 'mincer' branch to replace GCP (both?)

    • https://github.com/nodeca/mincer
    • https://github.com/clarkdave/connect-mincer
  • 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)

    • render views partials within EJS

Documentation

Command Line

Features

Command Line

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 server
Grand 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 contact
    create  controller/company.js

gce generate model NAME [field:type field:type]

Generates a model with provided attributes.

$ gce generate model book title:string author:string
    create  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 -c
    create  models/Animal.js
    create  controllers/animal.js
    update  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:string
    create  client/models/Animal.js
    create  client/collections/animalList.js

gce [backbone | bb] view NAME

Generates Backbone view.

$ gce bb view item
    create  client/views/itemView.js

gce migrate

[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.

Features

See Grand Central Junction. Default routes file is /config/routes.js, default controllers path is /controllers.


Defined in the /models folder, with capitalized names like Person.js. The model is defined like so:

var Model = require('grand-central-express').Model;
module.exports = new Model({
    name: "Person",
    schema: {
        name: String,
        email: String,
        admin: Boolean,
        rank: Number
    }
});

Methods, validations and relationships are still in development.


The default ORM is Grand Central Records, but can be quickly changed to JugglingDB or Node-ORM using the following steps:

  1. Change your dependency package.json from 'grand-central-records' to either 'jugglingdb' or 'orm'
  2. In app.js, change...

Models are accessed in controllers:

exports.show = function(req, res, models) {
    var id = req.param('id');
    models.Person.find(id, function(err, person) {
        if (err) throw err;
        res.json(person);
    });
};

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.

{
    "development": {
        "adapter":  "sqlite3",
        "host":     "",
        "database": "db/development.sqlite3",
        "username": "",
        "password": ""
    }
}

The template defaults to using SQLite3 files for both development and production.


See Grand Central Pipeline.