<commit_before># Nodal
## An ES6 API Server and Framework for iojs

[![Build Status](https://travis-ci.org/keithwhor/nodal.svg?branch=master)](https://travis-ci.org/keithwhor/nodal)

**v0.2.x is pre-release, suggested for use in development only**

Nodal is an opinionated API Server and Framework for quickly generating
RESTful API services in [iojs](https://iojs.org/).

It is intended to be used for cross-platform applications with various
client-side implementations or loosely-coupled services where responses to
requests are generally limited to structured data. (Though there is
support for HTML and static resources, they are not a priority.)

With a built-in command-line interface, models, controllers, templates,
migrations and application architecture, Nodal provides all of the tools a
developer needs to get a new iojs project started with very little overhead.

Writing your server software in Nodal should feel natural coming from other
MVC frameworks such as Django and Rails. While Nodal certainly borrows many
concepts from these frameworks (standing on the shoulders of giants), it has a
distinct architecture and decisions about feature implementation vary.

## Features

- ES6
- Models
- Controllers
- Templates
- Migrations
- Routing
- Query Composition
- Multiple database connections
- Multiple environment configurations
- Middleware (gzip/deflate middleware pre-packaged)
- Initializers

Additionally, a built-in CLI that supports:

- Starting a new project
- Easy generation of models, controllers, migrations, middleware, initializers
- Database drop, create, prepare, migrate, rollback
- Running your Nodal server

Nodal comes configured to deploy to Heroku easily (using git) for rapid
prototyping.

## Installation

To install the latest version of Nodal, make sure you have [iojs](https://iojs.org/) installed.

You can then run:

```
$ sudo npm install nodal -g
```

And voila! You now have access to the Nodal command-line interface.

If you're intending on data layer integration, Nodal only supports Postgres at
present time. I personally recommend using
[Postgres.app](http://postgresapp.com/) for your dev environment if you're
running OSX.

## Getting Started

Docs are a work in progress, so if you want to just dive in, follow these simple
instructions to start hacking away with Nodal. ;)

Getting started with Nodal is simple. Just run `nodal new` and you'll be guided
through the process. Nodal will create a project directory for you in your
current directory based on your project name.

Now you can run `nodal s` to start your server, and voila! Your index page will
be available at `localhost:3000` under default configurations.

If you want to get set up with some users, proceed with the following:

First, Make sure you have Postgres installed

On OSX, use [Postgres.app](http://postgresapp.com/)

Next, create a "postgres" superuser with no password if one does not already exist
```
$ createuser postgres -s
```

Open your `app/init.js` file and uncomment the line:
```
// app.useDatabase('main', Nodal.my.Config.db.main);
```

Finally, run the following commands:
```
$ nodal db:create<commit_msg>updates<commit_after># Nodal
## An ES6 API Server and Framework for iojs

[![Build Status](https://travis-ci.org/keithwhor/nodal.svg?branch=master)](https://travis-ci.org/keithwhor/nodal)

**v0.2.x is pre-release, suggested for use in development only**

Nodal is an opinionated API Server and Framework for quickly generating
RESTful API services in [iojs](https://iojs.org/).

It is intended to be used for cross-platform applications with various
client-side implementations or loosely-coupled services where responses to
requests are generally limited to structured data. (Though there is
support for HTML and static resources, they are not a priority.)

With a built-in command-line interface, models, controllers, templates,
migrations and application architecture, Nodal provides all of the tools a
developer needs to get a new iojs project started in a very short amount of
time.

Writing your server software in Nodal should feel somewhat natural coming from
other MVC frameworks such as Django and Rails. While Nodal certainly borrows
many concepts from these frameworks (standing on the shoulders of giants), it
has a distinct architecture and decisions about feature implementation vary.

## Features

- ES6
- Models
- Controllers
- Templates
- Migrations
- Routing
- Query Composition
- Multiple database connections
- Multiple environment configurations
- Middleware (gzip/deflate middleware pre-packaged)
- Initializers

Additionally, a built-in CLI that supports:

- Starting a new project
- Easy generation of models, controllers, migrations, middleware, initializers
- Database drop, create, prepare, migrate, rollback
- Running your Nodal server

Nodal comes configured to deploy to Heroku easily (using git) for rapid
prototyping.

## Installation

To install the latest version of Nodal, make sure you have
[iojs](https://iojs.org/) installed.

You can then run:

```
$ sudo npm install nodal -g
```

And voila! You now have access to the Nodal command-line interface.

If you're intending on data layer integration, Nodal only supports Postgres at
present time. I personally recommend using
[Postgres.app](http://postgresapp.com/) for your dev environment if you're
running OSX.

## Getting Started

Docs are a work in progress, so if you want to just dive in, follow these simple
instructions to start hacking away with Nodal. ;)

Getting started with Nodal is simple. Just run `nodal new` and you'll be guided
through the process. Nodal will create a project directory for you in your
current directory based on your project name.

Now you can run `nodal s` to start your server, and voila! Your index page will
be available at `localhost:3000` under default configurations. A 404 page and
static resources page are also available. (Static resources are stored in
  your `./static/` directory.)

If you want to get set up with some users, proceed with the following:

First, Make sure you have Postgres installed. On OSX I'm a fan of
[Postgres.app](http://postgresapp.com/).

Next, create a "postgres" superuser with no password if one does not already exist
```
$ createuser postgres -s
```

Open your `app/init.js` file and uncomment the line:
```
// app.useDatabase('main', Nodal.my.Config.db.main);
```

Finally, run the following commands:
```
$ nodal db:create
{'fraction_non_alphanumeric': 0.07092969113766878, 'fraction_numerical': 0.002948936830668943, 'mean_word_length': 4.584055459272097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1130032', 'n_tokens_mistral': 1811, 'n_tokens_neox': 1690, 'n_words': 860}