restify / restify/node-restify

Multiple optional params with restify-router

Open
#1,764 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.7k
Forks
975
Avg merge
1d 6h
Merged PRs (30d)
5

Description

Hi, I have a problem with restify and restify-router. I have this route, which works correctly with express. I recently switched to restify and can't find a way to make it work.

const Router = require('restify-router').Router;
const router = new  Router();
const restify = require('restify');
const app = restify.createServer();
app.use(restify.plugins.queryParser());
app.use(restify.plugins.bodyParser({ mapParams: false }));
router.add('/:father_model/:father_id?/:child1_model?/:child1_id?/:child2_model?/:child2_id?/:child3_model?/:child3_id?/:child4_model?/:child4_id?', CrudRouter);
router.applyRoutes(app);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the route in the shown restify and restify-router setup, then compare its behavior with Express. Trace the route declaration and the CrudRouter entry point; done means the optional-parameter behavior is explained and a supported resolution or limitation is established.

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
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.