Skip to content
Luis Eduardo Brito edited this page Aug 29, 2013 · 5 revisions

Controllers

Are defined in /api/controllers/ as [name].js. Example: /api/controllers/user.js.

The route to the controller have to be defined in the API Routes config file, located at: /routes/api.js

File structure: /api/controllers/test.js

module.exports = {
	
	// route: /test
	index: function(req, res) {
		res.json({
			test: "ok"
		})
	},
	
	// route: /test/get
	get: function(req, res) {
		res.json({
			test: "ok"
		})
	},

}
Clone this wiki locally