Reputation: 1765
Sails JS v1.0.1
I generate simple API by using sails generate api articles
, and use blueprints to fill db. Next I updated my model. But when I started to fill my controller somethings went wrong. Here is my controller:
/**
* ArticlesController
*
* @description :: Server-side actions for handling incoming requests.
* @help :: See https://sailsjs.com/docs/concepts/actions
*/
module.exports = {
list: function (req, res) {
sails.log.debug('Im inside list!');
return res.view('list');
},
add: function (req, res) {
sails.log.debug('Im inside add!');
return res.view('../pages/add');
},
};
I can get all blueprints as json in /articles
but /articles/list
and /articles/add
show 404 page. Even dont know how to debug. Thanks!
upd. I added them to routes and all works fine.
'get /articles/list': 'ArticlesController.list',
'get /articles/add': 'ArticlesController.add',
But is it true way to do this??? Why all my routes not compile automatically when I did sails generate api articles
??
Upvotes: 0
Views: 88
Reputation: 1255
You need to enable sails.config.blueprints.actions
, you can find it in config/blueprints
and set actions
to true
.
Upvotes: 1