balderdashy / balderdashy/sails

After enabling blueprint autorouting and the custom "prefix" setting, unexpected extra shadow route (sails.config.blueprints.actions + sails.config.blueprints.prefix)

Open
#4,368 1 comment 0 reactions 0 assignees View on GitHub
blueprints bug helpful info or workaround
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**Sails version**: 1.0.1
**Node version**: 9.11.1
**NPM version**: 5.6.0
**DB adapter name**: N/A
**DB adapter version**: N/A
**Operating system**: macOS High Sierra 10.13.4



Hi, I'm having an issue with the automatic routes generated by sails.

I have created a `DocumentationController.js` file inside `api/controllers` folder and added an action called `index`.
I have changed `blueprints.js` `actions` config to `true`.
When I lift the app, I can navigate `http://localhost:1337/documentation` and the method works correctly.

Now, when I add `prefix: '/content'` to `blueprints.js` file and lift the app again, I can navigate `http://localhost:1337/documentation` (works correctly) and `http://localhost:1337/content/documentation` (does not work), but `http://localhost:1337/content/documentation/index` does respond correctly.

Correct me if I'm wrong, but I believe this was not the intended functionality.

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start with the api/controllers/DocumentationController.js action and the blueprints.js actions and prefix settings described in the report. Reproduce the three documented URLs after lifting the app, then trace how blueprint autorouting handles the prefix. Done means the configured routes no longer expose the unexpected behavior while the intended action route still responds.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.