<commit_before>![VulpeJS](https://github.com/lordfelipe/vulpejs/raw/master/images/vulpejs.png)
# VulpeJS

Open-Source Full-Stack solution to Node.js applications with `Express.js`, `Jade`, `AngularJS` and `MongoDB`.

Works on Linux (stable) & MacOSx (stable) & Windows (stable).

[![NPM version](https://badge.fury.io/js/vulpejs.svg)](http://badge.fury.io/js/vulpejs) [![Gitter](https://badges.gitter.im/lordfelipe/vulpejs.svg)](https://gitter.im/lordfelipe/vulpejs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://api.travis-ci.org/lordfelipe/vulpejs.svg?branch=master)](https://travis-ci.org/lordfelipe/vulpejs) [![Inline docs](http://inch-ci.org/github/lordfelipe/vulpejs.svg?branch=master)](http://inch-ci.org/github/lordfelipe/vulpejs) [![Dependency Status](https://david-dm.org/lordfelipe/vulpejs.svg)](https://david-dm.org/lordfelipe/vulpejs)

[![NPM](https://nodei.co/npm/vulpejs.png?downloads=true&downloadRank=true)](https://nodei.co/npm/vulpejs/)

## Install
Add VulpeJS dependency in your `package.json`
```json
...
"vulpejs": "~0.0.14",
...
```

And run install:

    npm install

Enjoy!

## Examples

### Creating a Simple CRUD
Add Model `models/city.js`
```javascript
  "use strict";

  /**
   * Create City Model
   * @return {Object} Model
   */
  module.exports = vulpejs.models.make({
    name: 'City',
    schema: {
      name: {
        type: String,
        required: true
      },
      acronym: {
        type: String,
        required: true
      },
      status: {
        type: String,
        required: true,
        'default': 'ACTIVE',
        enum: ['ACTIVE', 'INACTIVE']
      },
      modified: {
        type: Date,
        'default': Date.now
      },
      user: {
        type: vulpejs.mongoose.Schema.Types.ObjectId,
        ref: 'User'
      }
    }
  });
```
Add Route `routes/city.js`
```javascript
"use strict";

/**
 * Create City Routes
 * @return {Object} Express Router
 */
module.exports = vulpejs.routes.make({
  name: 'city',
  plural: 'cities',
  save: {
    data: ['name', 'acronym']
  },
  ui: {
    controller: {
      name: 'City',
      service: {
        plural: 'cities',
        predicate: 'name',
        focus: 'name',
        messages: {
          validate: {
            exists: 'City already exists.'
          }
        },
        model: {
          name: '',
          acronym: '',
          status: 'ACTIVE'
        }
      }
    },
    main: {
      title: 'City',
      inputs: [{
        type: 'text',
        name: 'name',
        label: 'Name',
        capitalize: 'first',
        required: true
      }, {
        type: 'text',
        name: 'acronym',
        label: 'Acronym',
        case: 'upper',
        required: true
      }]
    },
    select: {
      title: 'City List',
      filter: {
        search: {
          colspan: 2
        },
        status: {
          colspan: 2,
          items: [{
            value: 'ACTIVE',
            label: 'Active'
          }, {
            value: 'INACTIVE',
            label: 'Inactive'
          }]
        }
      },
      items: [{
        name: 'name',
        label: 'Name',
        style: {
          width: '55%'
        }
      }, {
        name: 'acronym',
        label: 'Acronym',
        style: {
          width: '10%'
        }
      }, {
        name: 'status',
        style: {
          'class': 'text-center',
          width: '10%'
        },
        images: [{
          name: 'status-online.png',
          show: "vulpejs.equals(selectItem, 'status', 'ACTIVE')",
          title: 'Active'
        }, {
          name: 'status-offline.png',<commit_msg>update doc<commit_after>![VulpeJS](https://github.com/lordfelipe/vulpejs/raw/master/images/vulpejs.png)
# VulpeJS

Open-Source Full-Stack solution to Node.js applications with `Express.js`, `Jade`, `AngularJS` and `MongoDB`.

Works on Linux (stable) & MacOSx (stable) & Windows (stable).

[![NPM version](https://badge.fury.io/js/vulpejs.svg)](http://badge.fury.io/js/vulpejs) [![Gitter](https://badges.gitter.im/lordfelipe/vulpejs.svg)](https://gitter.im/lordfelipe/vulpejs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://api.travis-ci.org/lordfelipe/vulpejs.svg?branch=master)](https://travis-ci.org/lordfelipe/vulpejs) [![Inline docs](http://inch-ci.org/github/lordfelipe/vulpejs.svg?branch=master)](http://inch-ci.org/github/lordfelipe/vulpejs) [![Dependency Status](https://david-dm.org/lordfelipe/vulpejs.svg)](https://david-dm.org/lordfelipe/vulpejs)

[![NPM](https://nodei.co/npm/vulpejs.png?downloads=true&downloadRank=true)](https://nodei.co/npm/vulpejs/)

## Install
Add VulpeJS dependency in your `package.json`
```json
...
"vulpejs": "~0.0.14",
...
```

And run install:

    npm install

Enjoy!

## Examples

### Creating a Simple CRUD
Add Model `models/city.js`
```javascript
  "use strict";

  /**
   * Create City Model
   * @return {Object} Model
   */
  module.exports = vulpejs.models.make({
    name: 'City',
    schema: {
      name: {
        type: String,
        required: true
      },
      acronym: {
        type: String,
        required: true
      },
      status: {
        type: String,
        required: true,
        'default': 'ACTIVE',
        enum: ['ACTIVE', 'INACTIVE']
      },
      modified: {
        type: Date,
        'default': Date.now
      },
      user: {
        type: vulpejs.mongoose.Schema.Types.ObjectId,
        ref: 'User'
      }
    }
  });
```
Add Route `routes/city.js`
```javascript
"use strict";

/**
 * Create City Routes
 * @return {Object} Express Router
 */
module.exports = vulpejs.routes.make({
  name: 'city',
  plural: 'cities',
  save: {
    data: ['name', 'acronym']
  },
  ui: {
    controller: {
      name: 'City',
      service: {
        plural: 'cities',
        predicate: 'name',
        focus: 'name',
        messages: {
          validate: {
            exists: 'City already exists.'
          }
        },
        model: {
          name: '',
          acronym: '',
          status: 'ACTIVE'
        }
      }
    },
    main: {
      title: 'City',
      inputs: [{
        type: 'text',
        name: 'name',
        label: 'Name',
        capitalize: 'first',
        required: true
      }, {
        type: 'text',
        name: 'acronym',
        label: 'Acronym',
        case: 'upper',
        required: true
      }]
    },
    select: {
      title: 'City List',
      filter: {
        search: {
          colspan: 2
        },
        status: {
          colspan: 2,
          items: [{
            value: 'ACTIVE',
            label: 'Active'
          }, {
            value: 'INACTIVE',
            label: 'Inactive'
          }]
        }
      },
      items: [{
        name: 'name',
        label: 'Name',
        style: {
          width: '55%'
        }
      }, {
        name: 'acronym',
        label: 'Acronym',
        style: {
          width: '10%'
        }
      }, {
        name: 'status',
        style: {
          width: '10%'
        },
        css: {
          'class': 'text-center'
        },
        images: [{
          name: 'status-online.png',
          show: "vulpejs.equals(selectItem, 'status', 'ACTIVE')",
          title: 'Active'
        }, {
          name: 'status-offline.png',
{'fraction_non_alphanumeric': 0.1687158469945355, 'fraction_numerical': 0.003278688524590164, 'mean_word_length': 1.8834186687672312, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3969423', 'n_tokens_mistral': 2544, 'n_tokens_neox': 2513, 'n_words': 445}