-
Notifications
You must be signed in to change notification settings - Fork 132
Conversation
if (err) return next(err);<% } %> | ||
<% if(options.database == 'mysql' || options.database == 'postgresql' || options.database == 'sqlite'){ %> | ||
db.Article.findById(req.params.articleId).then(function (article) {<% } %><% if(options.database == 'rethinkdb'){ %> | ||
Article.filter(r.row('id').eq(req.params.articleId)).run().then(function (article) {<% } %><% if(options.database == 'none'){ %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With Thinky you can use Article.get(req.params.articleId)
see: https://thinky.io/documentation/api/query/
<% if(options.viewEngine == 'marko'){ %> | ||
var indexTemplate = marko.load(require.resolve('../views/articles/view.marko'));<% } %> | ||
router.get('/:articleId', function (req, res, next) {<% if(options.database == 'mongodb'){ %> | ||
Article.findOne({ '_id': req.params.articleId }, function (err, article) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With mongoose use findById
: http://mongoosejs.com/docs/api.html#model_Model.findById
Hey looking good so far!
|
Thanks! I believe I've updated everything, the queries and the mvc-views. I suspect so about coffee script, perhaps drop support for it? Since it's a generator, projects using it have already been generated so don't need to worry about upgrade path? |
While I'd like to, someone put some effort in and contributed coffeescript. If someone were to upgrade the generator they might then be surprised to find it won't generate coffeescript anymore. Unfortunately I don't have any data on how many people use it :/ I will check on your latest when I've got a chance |
Hey sorry I've taken a while on this, the code looks good but I just need to test actually running it which is something the tests don't really do. Have you tested running the coffeescript stuff locally? |
Adding articles controller example to mvc, #211
It's not ready for merge, figured better to commit early and see feedback to make sure going right direction. Never done a generator before.
Some pending issues:
I've done a simple test where where generated a project and verified articles returned the No Articles yet message.