nitrojs / nitrojs/nitro

[routeRules] Support `redirect: '<path> <statusCode>'` alias

Open
#1,707 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dx enhancement v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

It would be nice to support:

'/get-started': { redirect: '/get-started/installation 301' },
// Similar to
'/get-started': { redirect: { to: '/get-started/installation', statusCode: 301 } },

I believe it could be done here: https://github.com/unjs/nitro/blob/11a241244a166b0733b924d16ce5a32e1be89005/src/options.ts#L419

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 in src/options.ts around line 419 and trace how routeRules redirect values are parsed or normalized. Confirm the string form accepts a path followed by a status code, matching the object form shown in the issue; done means both forms produce equivalent redirects.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.