fastify / fastify/fastify-http-proxy

Add an option to disable the wildcard route or to select the ones to be enabled

Open
#420 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
395
Forks
108
Avg merge
1d 19h
Merged PRs (30d)
2

Description

### Prerequisites

- [x] I have written a descriptive issue title
- [x] I have searched existing issues to ensure the feature has not already been requested

### 🚀 Feature Proposal

The proposal is to have a way to select what route to create between the standard one and the one with the wildcard.

This is the current implementation (both routes are created):
```js
fastify.route({
url: '/',
method: opts.httpMethods || httpMethods,
preHandler,
config: opts.config || {},
constraints: opts.constraints || {},
handler
})
fastify.route({
url: '/*',
method: opts.httpMethods || httpMethods,
preHandler,
config: opts.config || {},
constraints: opts.constraints || {},
handler
})
```

There may be an option to disable the wildcard route or to select those to be enabled.
I can do this myself if the idea seems reasonable.

### Motivation

If I want to create a route for the `/foo` path, I also want Fastify to return a 404 response to the `/foo/bar` route, without trying to forward it to the downstream if not wanted.

### Example

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.