0.1.39 • Published 7 years ago

vulpejs v0.1.39

Weekly downloads
6
License
ISC
Repository
github
Last release
7 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

7 years ago

0.1.38

8 years ago

0.1.37

8 years ago

0.1.36

8 years ago

0.1.35

8 years ago

0.1.34

8 years ago

0.1.33

8 years ago

0.1.32

8 years ago

0.1.31

8 years ago

0.1.30

8 years ago

0.1.29

8 years ago

0.1.28

8 years ago

0.1.27

8 years ago

0.1.26

9 years ago

0.1.25

9 years ago

0.1.24

9 years ago

0.1.23

9 years ago

0.1.22

9 years ago

0.1.21

9 years ago

0.1.20

9 years ago

0.1.19

9 years ago

0.1.18

9 years ago

0.1.17

9 years ago

0.1.16

9 years ago

0.1.15

9 years ago

0.1.14

9 years ago

0.1.13

9 years ago

0.1.12

9 years ago

0.1.11

9 years ago

0.1.10

9 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.24

9 years ago

0.0.23

9 years ago

0.0.22

9 years ago

0.0.21

9 years ago

0.0.20

9 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago