balderdashy / balderdashy/sails

different url between Blueprint routes & controller/action routes

Open
#4,403 2 comments 0 reactions 0 assignees View on GitHub
blueprints mongo resolved
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**Sails version**: 1.0.2
**Node version**: 10.1.0
**NPM version**: 5.6.0
**DB adapter name**: sails-mongo
**DB adapter version**: 1.0.1
**Operating system**: Mac OS


I was used Command line generators sails code with name **UserTeam** :

```
sails generate model UserTeam
// I has: models/UserTeam.js
```

```
sails generate action UserTeam/create
// I has: controllers/user-team/create.js
```

I want to used Sails as REST Service. and I tried to overwrite **Blueprint actions** `Create` of UserTeam.

But it different url between **Blueprint routes** & **controller/action** routes.
**userTeam** => Blueprint route
**user-team** => action route

I know i can define new route
```
// configs/routes.js
'POST /UserTeam': { action: 'user-team/create'}
```

Why not map Blueprint route **user-team** to **UserTeam model**
replace capital letters by lowercase & dash letter (**Blueprint routes**)

```
UserTeam => user-team
ContentSource => content-source
```

Contributor guide

Open the contributing guide

Research direction

Start with the generated paths in models/UserTeam.js and controllers/user-team/create.js, then read configs/routes.js to compare Blueprint and action route naming. Reproduce the URL difference on Sails 1.0.2 and determine whether the route convention should be unified; done means the documented or implemented mapping consistently produces the expected REST URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.