Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix routes

  • Loading branch information...
commit b9c8a4dcfb496fd370594e7faeb3a78cdacee03d 1 parent 183cd9f
@biggora authored
View
23 app.js
@@ -8,7 +8,8 @@ engine = require('ejs-locals'),
useragent = require('express-useragent'),
sessionStore = require("./utils/session")(express),
helper = require('./utils/helper'),
-flash = require('./utils/flash');
+flash = require('./utils/flash'),
+config = require('./config');
var curpath = __dirname.replace(/\\/gi,"/"); // Fix for Windows
var app;
@@ -45,20 +46,20 @@ function bootApplication(app) {
app.configure(function () {
app.use(express.compress());
- app.use(express.methodOverride());
app.use(express.bodyParser({
uploadDir: curpath + '/uploads',
keepExtensions: true,
- encoding: 'utf-8'
+ encoding: config.parser.encoding
}));
- app.use(express.cookieParser('secret'));
+ app.use(express.methodOverride());
+ app.use(express.cookieParser(config.session.secret));
app.use(express.session({
cookie: {
- maxAge: 8640000
+ maxAge: config.session.maxAge
},
- key: 'trinte',
- secret: 'secret',
- store: new sessionStore({ url : app.set('db-uri') })
+ key: config.session.key,
+ secret: config.session.secret,
+ store: new sessionStore({ url : config.dburi() })
}));
app.use(flash());
app.use(express.csrf());
@@ -67,7 +68,7 @@ function bootApplication(app) {
app.use(express.static(curpath + '/public'));
// Setup ejs views as default, with .html as the extension
- app.set('port', process.env.PORT || 3000);
+ app.set('port', process.env.PORT || config.port);
app.set('views', curpath + '/views');
app.engine('html', engine);
app.set('view engine', 'html');
@@ -90,7 +91,6 @@ function bootApplication(app) {
app.use(function (req, res) {
res.render('404');
});
-
});
}
@@ -103,7 +103,7 @@ function bootModels(app) {
});
});
// Connect to mongoose
- mongoose.connect(app.set('db-uri'));
+ mongoose.connect(config.dburi());
}
// Bootstrap controllers
@@ -121,7 +121,6 @@ function bootControllers(app) {
function bootModel(app, file) {
var name = file.replace('.js', ''),
schema = require(curpath + '/models/' + name); // Include the mongoose file
-
}
// Load the controller, link to its view file from here
View
11 app.json
@@ -5,11 +5,12 @@
"author": "",
"private": true,
"dependencies": {
- "ejs-locals" : ">=1.0.2",
- "express" : ">=3.0.0",
- "mongoose" : ">=3.0.0",
- "socket.io" : ">=0.8.0",
+ "ejs-locals" : ">=1.0.2",
+ "express" : ">=3.0.0",
+ "mongodb" : ">=1.2.6",
+ "mongoose" : ">=3.0.0",
+ "socket.io" : ">=0.8.0",
"express-useragent" : ">=0.0.7",
- "trinte" : ">0.0.4"
+ "trinte" : ">0.0.4"
}
}
View
1  bin/trinte
@@ -242,6 +242,7 @@ function createApplicationAt(path,appname) {
copy(bootstrapPath + '/app-cluster.js', appdir + '/app-cluster.js');
copy(bootstrapPath + '/app.js', appdir + '/app.js');
+ copy(bootstrapPath + '/config.js', appdir + '/config.js');
var layout = fs.readFileSync(bootstrapPath + '/views/layout.html', 'utf-8');
write(appdir + '/views/layout.html', layout.toString().replace(/APPNAME/gi,appname));
View
1  conf/development.js
@@ -2,7 +2,6 @@
* DEVELOPMENT Environment settings
*/
module.exports = function(app,express) {
- app.set('db-uri', 'mongodb://localhost/trinte-development');
app.use(express.logger("dev"));
app.use(express.errorHandler({
dumpExceptions: true,
View
1  conf/production.js
@@ -3,7 +3,6 @@
* TEST Environment settings
*/
module.exports = function(app,express) {
- app.set('db-uri', 'mongodb://localhost/trinte-production');
app.use(express.logger({
format: ':method :url :status'
}));
View
2  conf/test.js
@@ -3,7 +3,6 @@
* PRODUCTION Environment settings
*/
module.exports = function(app,express) {
- app.set('db-uri', 'mongodb://localhost/trinte-production');
app.use(express.logger({
format: ':method :url :status'
}));
@@ -12,5 +11,4 @@ module.exports = function(app,express) {
dumpExceptions: false,
showStack: false
}));
-
}
View
31 config.js
@@ -0,0 +1,31 @@
+module.exports = {
+ port : 3000,
+ session: {
+ maxAge : 8640000,
+ key : "trinte",
+ secret : "Web-based Application"
+ },
+ parser : {
+ encoding : "utf-8",
+ keepExtensions : true
+ },
+ db: {
+ host : "localhost",
+ port : "27017",
+ username : "",
+ password : "",
+ database : "trinte-dev"
+ },
+ dburi: function() {
+ var uri = "mongodb://", port = 27017;
+ if(this.db.username != "" && this.db.password != "") {
+ uri += this.db.username + ':' + this.db.password + '@';
+ }
+ if(this.db.port != "") {
+ port = this.db.port;
+ }
+ uri += this.db.host + ':' + port;
+ uri += '/' + this.db.database
+ return uri;
+ }
+}
View
60 controllers/AppController.js
@@ -1,29 +1,12 @@
var fs = require('fs')
- , inflection = require('../lib/inflection');
+, inflection = require('../lib/inflection');
-module.exports = function (app) {
-
- // app.get("/favicon.ico", function() {}); // Required if you delete the favicon.ico from public
-
- // Plural
- app.get("/:controller?", router); // Index
- app.get("/:controller.:format?", router); // Index
- app.get("/:controller/:from-:to.:format?", router); // Index
-
- // Plural Create & Delete
- app.post("/:controller", router); // Create
- app.del("/:controller", router); // Delete all
-
- // Singular - different variable to clarify routing
- app.get("/:controller/:action", router); // Add (New)
- app.get("/:controller/:id.:format?", router); // To support controller/index
- app.get("/:controller/:id/:action", router); // Show edit
- app.put("/:controller/:id", router); // Update
- app.del("/:controller/:id", router); // Delete
-
-}
-
-///
+/*
+ * Default Application router.
+ * @param {Object} req
+ * @param {Object} res
+ * @param {Function} next
+ */
function router(req, res, next) {
var controller = req.params.controller ? req.params.controller : '';
@@ -91,12 +74,12 @@ function router(req, res, next) {
}
};
-
/**
* Default Application index - shows a list of the controllers.
* Redirect here if you prefer another controller to be your index.
- * @param req
- * @param res
+ * @param {Object} req
+ * @param {Object} res
+ * @param {Function} next
*/
function index(req, res, next) {
@@ -121,3 +104,26 @@ function index(req, res, next) {
});
});
};
+
+
+module.exports = function (app) {
+
+ // app.get("/favicon.ico", function() {}); // Required if you delete the favicon.ico from public
+
+ // Plural
+ app.get("/:controller?", router); // Index
+ app.get("/:controller.:format?", router); // Index
+ app.get("/:controller/:from-:to.:format?", router); // Index
+
+ // Plural Create & Delete
+ app.post("/:controller", router); // Create
+ app.del("/:controller", router); // Delete all
+
+ // Singular - different variable to clarify routing
+ app.get("/:controller/:action", router); // Add (New)
+ app.get("/:controller/:id.:format?", router); // To support controller/index
+ app.get("/:controller/:id/:action", router); // Show edit
+ app.put("/:controller/:id", router); // Update
+ app.del("/:controller/:id", router); // Delete
+
+}
View
42 lib/ExamplesController.js
@@ -14,10 +14,10 @@ module.exports = {
},
/**
- * Index action, returns a list either via the views/examples/index.html view or via json
- * Default mapping to GET '/examples'
- * For JSON use '/examples.json'
- **/
+ * Index action, returns a list either via the views/examples/index.html view or via json
+ * Default mapping to GET '/examples'
+ * For JSON use '/examples.json'
+ **/
index: function(req, res, next) {
var from = req.params.from ? parseInt(req.params.from) - 1 : 0;
@@ -53,10 +53,10 @@ module.exports = {
},
/**
- * Show action, returns shows a single item via views/examples/show.html view or via json
- * Default mapping to GET '/example/:id'
- * For JSON use '/example/:id.json'
- **/
+ * Show action, returns shows a single item via views/examples/show.html view or via json
+ * Default mapping to GET '/example/:id'
+ * For JSON use '/example/:id.json'
+ **/
show: function(req, res, next) {
Example.findById(req.params.id, function(err, example) {
@@ -77,9 +77,9 @@ module.exports = {
},
/**
- * Edit action, returns a form via views/examples/edit.html view no JSON view.
- * Default mapping to GET '/example/:id/edit'
- **/
+ * Edit action, returns a form via views/examples/edit.html view no JSON view.
+ * Default mapping to GET '/example/:id/edit'
+ **/
edit: function(req, res, next){
Example.findById(req.params.id, function(err, example) {
if(err) return next(err);
@@ -90,9 +90,9 @@ module.exports = {
},
/**
- * Update action, updates a single item and redirects to Show or returns the object as json
- * Default mapping to PUT '/example/:id', no GET mapping
- **/
+ * Update action, updates a single item and redirects to Show or returns the object as json
+ * Default mapping to PUT '/example/:id', no GET mapping
+ **/
update: function(req, res, next){
Example.findById(req.params.id, function(err, example) {
@@ -120,9 +120,9 @@ module.exports = {
},
/**
- * Create action, creates a single item and redirects to Show or returns the object as json
- * Default mapping to POST '/examples', no GET mapping
- **/
+ * Create action, creates a single item and redirects to Show or returns the object as json
+ * Default mapping to POST '/examples', no GET mapping
+ **/
create: function(req, res, next){
var example = new Example(req.body.example);
@@ -149,9 +149,9 @@ module.exports = {
},
/**
- * Delete action, deletes a single item and redirects to index
- * Default mapping to DEL '/example/:id', no GET mapping
- **/
+ * Delete action, deletes a single item and redirects to index
+ * Default mapping to DEL '/example/:id', no GET mapping
+ **/
destroy: function(req, res, next){
Example.findById(req.params.id, function(err, example) {
@@ -172,7 +172,5 @@ module.exports = {
}
});
});
-
}
-
};
View
10 package.json
@@ -11,7 +11,7 @@
"express",
"mongodb"
],
- "version": "0.0.4-7",
+ "version": "0.0.5",
"homepage": "https://github.com/biggora/trinte",
"repository": {
"type": "git",
@@ -20,16 +20,18 @@
"main": "trinte",
"author": "Aleksej Gordejev <aleksej@gordejev.lv> (https://github.com/biggora/)",
"engines": {
- "node": ">=0.8"
+ "node": ">=0.8",
+ "npm": ">=1.0"
},
"dependencies": {
"should": ">=1.2.0",
- "wrench": ">=1.4.4"
+ "wrench": ">=1.4.4",
+ "ejs": ">=0.8.0",
+ "mongodb": ">=1.2.6",
},
"devDependencies": {
"express": ">=3.0.0",
"connect": ">=2.0.0",
- "ejs": ">=0.8.0",
"socket.io": ">=0.8.0",
"mongoose": ">=3.0.0"
},
View
18 scripts/create-controller.js
@@ -51,6 +51,19 @@ exports.execute = function(params,appPath) {
}
}
+ var projectdata = {
+ name: "",
+ description: "",
+ version: "",
+ author: ""
+ };
+ if (fs.existsSync(appPath + '/package.json')) {
+ var pd = fs.readFileSync(appPath + '/package.json', "utf-8");
+ try {
+ projectdata = JSON.parse(pd);
+ } catch (err) {
+ }
+ }
// Read the template
var str = fs.readFileSync(controllerTemplate, 'utf8');
@@ -58,6 +71,11 @@ exports.execute = function(params,appPath) {
// Render the model
var ret = ejs.render(str, {
locals: {
+ pack: projectdata.name,
+ description: projectdata.description,
+ version: projectdata.version,
+ author: projectdata.author,
+ created: new Date().toISOString(),
controllerName:controllerName,
modelName:modelName
},
View
2  scripts/create-model.js
@@ -109,7 +109,7 @@ exports.execute = function (params, appPath) {
var ret = ejs.render(str, {
locals: {
name: modelName,
- package: projectdata.name,
+ pack: projectdata.name,
description: projectdata.description,
version: projectdata.version,
author: projectdata.author,
View
8 scripts/create-test.js
@@ -3,7 +3,6 @@ var ejs = require('ejs')
, path = require('path')
, inflection = require('../lib/inflection');
-
/**
* Script to create a default test scripts, requires the model to exist
*/
@@ -15,8 +14,8 @@ exports.execute = function(params,appPath) {
}
/**
- * Create the model based on a singular (e.g. people becomes person, users becomes user)
- */
+ * Create the model based on a singular (e.g. people becomes person, users becomes user)
+ */
var modelName = params[0].singularize();
if(modelName != params[0]) {
console.log("Using model name as singular not plural: " + modelName);
@@ -26,11 +25,8 @@ exports.execute = function(params,appPath) {
modelName = modelName.capitalize();
var modelFile = appPath + "/models/" + modelName + '.js'
-
var controllerName = modelName.pluralize();
-
var testFolder = appPath + "/tests/";
-
var unitTemplate = __dirname + '/templates/create-test.template.unit.ejs';
var integrationTemplate = __dirname + '/templates/create-test.template.integration.ejs';
var functionalTemplate = __dirname + '/templates/create-test.template.functional.ejs';
View
319 scripts/templates/create-controller.template.ejs
@@ -1,182 +1,181 @@
-<?
- var modelVariable = modelName.toLowerCase();
- var basePath = modelName.toLowerCase();
- var basePathPlural = controllerName.toLowerCase();
-?>
/**
* <?= controllerName ?> Controller
- * Created by create-controller script @ <?= new Date() ?>
+ *
+ * @package <?= pack ?>
+ * @version <?= version ?>
+ * @desc <?= description ?>
+ * @author <?= author ?>
+ * @created <?= created ?>
+ *
+ * Created by create-controller script
**/
- var mongoose = require('mongoose'),
- <?= modelName ?> = mongoose.model('<?= modelName ?>'),
- pager = require('../utils/pager.js'),
- ViewTemplatePath = '<?= basePathPlural ?>';
+<?
+var modelVariable = modelName.toLowerCase();
+var basePath = modelName.toLowerCase();
+var basePathPlural = controllerName.toLowerCase();
+?>
+var mongoose = require('mongoose'),
+<?= modelName ?> = mongoose.model('<?= modelName ?>'),
+pager = require('../utils/pager.js'),
+ViewTemplatePath = '<?= basePathPlural ?>';
module.exports = {
- /**
- * Index action, returns a list either via the views/<?= basePathPlural ?>/index.html view or via json
- * Default mapping to GET '/<?= basePathPlural ?>'
- * For JSON use '/<?= basePathPlural ?>.json'
- **/
- index: function(req, res, next) {
- var sort = req.query.sort || "_id";
- var from = req.params.from ? parseInt(req.params.from) - 1 : 0;
- var to = req.params.to ? parseInt(req.params.to) : 20;
- var total = 0;
-
- <?= modelName ?>.count({}, function (err, count) {
- total = count;
- var pagerHtml = pager.render(from,to,total,'/<?= basePathPlural ?>');
-
- <?= modelName ?>.find({})
- .sort(sort)
- .skip(from).limit(to)
- .find(function (err, <?= basePathPlural ?>) {
-
- if(err) return next(err);
+ /**
+ * Index action, returns a list either via the views/<?= basePathPlural ?>/index.html view or via json
+ * Default mapping to GET '/<?= basePathPlural ?>'
+ * For JSON use '/<?= basePathPlural ?>.json'
+ **/
+ index: function(req, res, next) {
+ var sort = req.query.sort || "_id";
+ var from = req.params.from ? parseInt(req.params.from) - 1 : 0;
+ var to = req.params.to ? parseInt(req.params.to) : 20;
+ var total = 0;
+
+ <?= modelName ?>.count({}, function (err, count) {
+ total = count;
+ var pagerHtml = pager.render(from, to, total,'/<?= basePathPlural ?>');
+
+ <?= modelName ?>.find({})
+ .sort(sort)
+ .skip(from).limit(to)
+ .find(function (err, <?= basePathPlural ?>) {
+
+ if(err) return next(err);
+
+ switch (req.params.format) {
+ case 'json':
+ res.send(<?= basePathPlural ?>.map(function(u) {
+ return u.toObject();
+ }));
+ break;
+ default:
+ res.render(ViewTemplatePath,{<?= basePathPlural ?>:<?= basePathPlural ?>,pagerHtml:pagerHtml});
+ }
+ });
+ });
+ },
- switch (req.params.format) {
- case 'json':
- res.send(<?= basePathPlural ?>.map(function(u) {
- return u.toObject();
- }));
- break;
+ /**
+ * Show action, returns shows a single item via views/<?= basePathPlural ?>/show.html view or via json
+ * Default mapping to GET '/<?= basePath ?>/:id'
+ * For JSON use '/<?= basePath ?>/:id.json'
+ **/
+ show: function(req, res, next) {
- default:
- res.render(ViewTemplatePath,{<?= basePathPlural ?>:<?= basePathPlural ?>,pagerHtml:pagerHtml});
- }
+ <?= modelName ?>.findById(req.params.id, function(err, <?= modelVariable ?>) {
- });
+ if(err) return next(err);
- });
+ switch (req.params.format) {
+ case 'json':
+ res.send(<?= modelVariable ?>.toObject());
+ break;
- },
+ default:
+ res.render(ViewTemplatePath + "/show",{<?= modelVariable ?>:<?= modelVariable ?>});
+ }
+ });
+ },
- /**
- * Show action, returns shows a single item via views/<?= basePathPlural ?>/show.html view or via json
- * Default mapping to GET '/<?= basePath ?>/:id'
- * For JSON use '/<?= basePath ?>/:id.json'
- **/
- show: function(req, res, next) {
+ /**
+ * New action, returns a form via views/<?= basePathPlural ?>/edit.html view no JSON view.
+ * Default mapping to GET '/<?= basePath ?>/new'
+ **/
+ add: function(req, res, next){
+ var <?= modelVariable ?> = new <?= modelName ?>();
+ res.render(ViewTemplatePath + "/new",{<?= modelVariable ?>:<?= modelVariable ?>});
+ },
+ /**
+ * Edit action, returns a form via views/<?= basePathPlural ?>/edit.html view no JSON view.
+ * Default mapping to GET '/<?= basePath ?>/:id/edit'
+ **/
+ edit: function(req, res, next){
+ <?= modelName ?>.findById(req.params.id, function(err, <?= modelVariable ?>) {
+ if(err) return next(err);
+ res.render(ViewTemplatePath + "/edit",{<?= modelVariable ?>:<?= modelVariable ?>});
+ });
+ },
- <?= modelName ?>.findById(req.params.id, function(err, <?= modelVariable ?>) {
+ /**
+ * Update action, updates a single item and redirects to Show or returns the object as json
+ * Default mapping to PUT '/<?= basePath ?>/:id', no GET mapping
+ **/
+ update: function(req, res, next){
+ <?= modelName ?>.update({
+ _id: req.params.id
+ }, {
+ $set: req.body.<?= modelVariable ?>
+ }, { multi: false }, function(err) {
+
+ if (err) {
+ console.log(err);
+ req.flash('error','Could not update <?= modelVariable ?>: ' + err);
+ res.redirect('/<?= basePathPlural ?>');
+ return;
+ }
+
+ switch (req.params.format) {
+ case 'json':
+ res.send(<?= modelVariable ?>.toObject());
+ break;
+ default:
+ req.flash('info', '<?= modelName ?> updated');
+ res.redirect('/<?= modelVariable ?>/' + req.params.id);
+ }
+ });
+ },
- if(err) return next(err);
+ /**
+ * Create action, creates a single item and redirects to Show or returns the object as json
+ * Default mapping to POST '/<?= basePathPlural ?>', no GET mapping
+ **/
+ create: function(req, res, next){
- switch (req.params.format) {
- case 'json':
- res.send(<?= modelVariable ?>.toObject());
- break;
+ var <?= modelVariable ?> = new <?= modelName ?>(req.body.<?= modelVariable ?>);
- default:
- res.render(ViewTemplatePath + "/show",{<?= modelVariable ?>:<?= modelVariable ?>});
- }
+ <?= modelVariable ?>.save(function(err) {
- });
+ if (err) {
+ req.flash('error','Could not create <?= modelVariable ?>: ' + err);
+ res.redirect('/<?= basePathPlural ?>');
+ return;
+ }
- },
+ switch (req.params.format) {
+ case 'json':
+ res.send(<?= modelVariable ?>.toObject());
+ break;
+ default:
+ req.flash('info','<?= modelName ?> created');
+ res.redirect('/<?= modelVariable ?>/' + <?= modelVariable ?>.id);
+ }
+ });
+ },
/**
- * New action, returns a form via views/<?= basePathPlural ?>/edit.html view no JSON view.
- * Default mapping to GET '/<?= basePath ?>/new'
+ * Delete action, deletes a single item and redirects to index
+ * Default mapping to DEL '/<?= basePath ?>/:id', no GET mapping
**/
- add: function(req, res, next){
- var <?= modelVariable ?> = new <?= modelName ?>();
- res.render(ViewTemplatePath + "/new",{<?= modelVariable ?>:<?= modelVariable ?>});
- },
- /**
- * Edit action, returns a form via views/<?= basePathPlural ?>/edit.html view no JSON view.
- * Default mapping to GET '/<?= basePath ?>/:id/edit'
- **/
- edit: function(req, res, next){
- <?= modelName ?>.findById(req.params.id, function(err, <?= modelVariable ?>) {
- if(err) return next(err);
- res.render(ViewTemplatePath + "/edit",{<?= modelVariable ?>:<?= modelVariable ?>});
- });
- },
-
- /**
- * Update action, updates a single item and redirects to Show or returns the object as json
- * Default mapping to PUT '/<?= basePath ?>/:id', no GET mapping
- **/
- update: function(req, res, next){
- <?= modelName ?>.update({
- _id: req.params.id
- }, {
- $set: req.body.<?= modelVariable ?>
- }, { multi: false }, function(err) {
-
- if (err) {
- console.log(err);
- req.flash('error','Could not update <?= modelVariable ?>: ' + err);
- res.redirect('/<?= basePathPlural ?>');
- return;
- }
-
- switch (req.params.format) {
- case 'json':
- res.send(<?= modelVariable ?>.toObject());
- break;
- default:
- req.flash('info', '<?= modelName ?> updated');
- res.redirect('/<?= modelVariable ?>/' + req.params.id);
- }
- });
- },
-
- /**
- * Create action, creates a single item and redirects to Show or returns the object as json
- * Default mapping to POST '/<?= basePathPlural ?>', no GET mapping
- **/
- create: function(req, res, next){
-
- var <?= modelVariable ?> = new <?= modelName ?>(req.body.<?= modelVariable ?>);
-
- <?= modelVariable ?>.save(function(err) {
-
- if (err) {
- req.flash('error','Could not create <?= modelVariable ?>: ' + err);
- res.redirect('/<?= basePathPlural ?>');
- return;
- }
-
- switch (req.params.format) {
- case 'json':
- res.send(<?= modelVariable ?>.toObject());
- break;
-
- default:
- req.flash('info','<?= modelName ?> created');
- res.redirect('/<?= modelVariable ?>/' + <?= modelVariable ?>.id);
- }
- });
-
- },
-
- /**
- * Delete action, deletes a single item and redirects to index
- * Default mapping to DEL '/<?= basePath ?>/:id', no GET mapping
- **/
- destroy: function(req, res, next){
-
- <?= modelName ?>.findById(req.params.id, function(err, <?= modelVariable ?>) {
-
- if (!<?= modelVariable ?>) {
- req.flash('error','Unable to locate the <?= modelVariable ?> to delete!');
- res.send('false');
- return false;
- };
-
- <?= modelVariable ?>.remove(function(err) {
- if(err) {
- req.flash('error','There was an error deleting the <?= modelVariable ?>!');
- res.send('/"<?= basePathPlural ?>"');
- } else {
- req.flash('info','<?= modelName ?> deleted');
- res.send('"/<?= basePathPlural ?>"');
- }
- });
- });
- }
+ destroy: function(req, res, next){
+
+ <?= modelName ?>.findById(req.params.id, function(err, <?= modelVariable ?>) {
+
+ if (!<?= modelVariable ?>) {
+ req.flash('error','Unable to locate the <?= modelVariable ?> to delete!');
+ res.send('false');
+ return false;
+ };
+
+ <?= modelVariable ?>.remove(function(err) {
+ if(err) {
+ req.flash('error','There was an error deleting the <?= modelVariable ?>!');
+ res.send('/"<?= basePathPlural ?>"');
+ } else {
+ req.flash('info','<?= modelName ?> deleted');
+ res.send('"/<?= basePathPlural ?>"');
+ }
+ });
+ });
+ }
};
View
4 scripts/templates/create-model.template.ejs
@@ -1,7 +1,7 @@
/**
* <?= name ?> schema
*
- * @package <?= package ?>
+ * @package <?= pack ?>
* @version <?= version ?>
* @desc <?= description ?>
* @author <?= author ?>
@@ -9,7 +9,7 @@
*
* Created by create-model script
**/
-
+
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;
View
2  tests/trinte.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * ExpressJs MVC Bootstrap
+ * TrinteJS MVC Bootstrap
* @Params - cmd - serve
r | script | params
*/
Please sign in to comment.
Something went wrong with that request. Please try again.