0.1.39 • Published 8 years ago

vulpejs v0.1.39

Weekly downloads
6
License
ISC
Repository
github
Last release
8 years ago

VulpeJS

VulpeJS

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

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

NPM version Gitter Build Status Inline docs Dependency Status

NPM

Examples

VulpeJS Heroku Apptest Example.

Install

Add VulpeJS dependency in your package.json

...
"vulpejs": "~0.1.39",
...

And run install:

npm install

Enjoy!

Examples

Creating a Simple CRUD

Add Model models/city.js

  "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

"use strict";

/**
 * Create City Routes
 * @return {Object} Express Router
 */
module.exports = vulpejs.routes.make({
  name: 'city',
  save: {
    data: ['name', 'acronym'],
  },
  ui: {
    controller: {
      name: 'City',
      service: {
        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',
        },
        switch: [{
          when: 'ACTIVE',
          image: 'status-online.png',
          title: 'Active',
        }, {
          when: 'INACTIVE',
          image: 'status-offline.png',
          title: 'Inactive',
        }, ],
        label: 'Status',
      }, {
        label: 'Actions',
        style: {
          width: '10%',
        },
      }, ],
      actions: [],
    },
  },
});

Run it:

$ npm start

And access:

http://localhost:3000/city
0.1.39

8 years ago

0.1.38

9 years ago

0.1.37

9 years ago

0.1.36

9 years ago

0.1.35

9 years ago

0.1.34

10 years ago

0.1.33

10 years ago

0.1.32

10 years ago

0.1.31

10 years ago

0.1.30

10 years ago

0.1.29

10 years ago

0.1.28

10 years ago

0.1.27

10 years ago

0.1.26

10 years ago

0.1.25

10 years ago

0.1.24

10 years ago

0.1.23

10 years ago

0.1.22

10 years ago

0.1.21

10 years ago

0.1.20

10 years ago

0.1.19

10 years ago

0.1.18

10 years ago

0.1.17

10 years ago

0.1.16

10 years ago

0.1.15

10 years ago

0.1.14

10 years ago

0.1.13

10 years ago

0.1.12

10 years ago

0.1.11

10 years ago

0.1.10

10 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.24

10 years ago

0.0.23

10 years ago

0.0.22

10 years ago

0.0.21

10 years ago

0.0.20

10 years ago

0.0.19

10 years ago

0.0.18

10 years ago

0.0.17

10 years ago

0.0.16

10 years ago

0.0.15

10 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago