CodeGenieApp / CodeGenieApp/serverless-express

NestJS example does not work with root paths

Offen
#443 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
5.3k
Forks
676
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

The [starter example for Nest JS](https://github.com/vendia/serverless-express/tree/mainline/examples/basic-starter-nestjs) does not work with root paths.

## Steps to reproduce

```shell
git clone https://github.com/vendia/serverless-express.git
cd serverless-express/examples/basic-starter-nestjs
npm ci
```

Remove the path from the [demo controller's handler](https://github.com/vendia/serverless-express/blob/mainline/examples/basic-starter-nestjs/src/app.controller.ts#L8) so it [defaults to the root path for the controller](https://docs.nestjs.com/controllers#routing).

```shell
npm run sls:offline
```

Make a request to `http://localhost:3000/dev`.

The server responds with a `404` error of `Cannot GET null`.

---

I have confirmed that this does not occur when using Nest JS without Serverless:

```shell
nest new nest-test
cd nest-test
npm run start
```

Make a request to `http://localhost:3000`.

The server responds with the expected response.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit examples/basic-starter-nestjs/src/app.controller.ts und reproduziere das Problem mit npm ci, npm run sls:offline und einer Anfrage an http://localhost:3000/dev. Verfolge, wie der Pfad des Root-Controllers behandelt wird, und überprüfe, dass die Anfrage nicht mehr die 404-Antwort Cannot GET null zurückgibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws, javascript, node.js
Bereich
api, backend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.