Tim Visser Tim Visser - 5 months ago 42
Node.js Question

KrakenJS controller routing

I have an admin controller

that looks like this:

"use strict";

var AdminModel = require('../models/admin');

module.exports = function (router) {

var model = new AdminModel();

router.get('/admin', function (req, res) {



If I start the application, getting the URL of http://localhost:8000/admin gives me
Cannot GET /admin
. However, getting /admin/admin gives me

My question is how do I get rid of the controller file name in the path of the URL?


first option is remove admin from router.get in admin.js controller

router.get('/admin', function (req, res) {

second check configuration in config director

config.json "router": { "module": { "arguments": [{ "directory": "path:./controllers" }] } }

for more study on controllers directory configuration : https://github.com/krakenjs/express-enrouten