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).
Examples
VulpeJS Heroku Apptest Example.
-
Download/Fork - https://github.com/activethread/vulpejs-heroku-apptest
-
Access Apptest - http://vulpejs-heroku-apptest.herokuapp.com/
- Username: admin@vulpe.org
- Password: vulpejs
Install
Add VulpeJS dependency in your package.json
...
"vulpejs": "~0.1.40",
...
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