CodeGenieApp / CodeGenieApp/serverless-express
Correct way to "do nothing"
- Vorherrschende Sprache
- JavaScript
- Sterne
- 5.3k
- Forks
- 676
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Hello, and first of all thanks for the very nice library :).
I have a simple use case, I want to authenticate using passport and if the user is authenticated, the function should do nothing. It will run as lambda@edge at `ViewerRequest` for cloudfront.
What is the correct way to do nothing, return or call one of the response methods (to set `200`, something like that)?
```javascript
// ... (passport / express setup)
app.get('*', (req, res) => {
if (req.isAuthenticated()) {
return; // What should come here?
} else {
res.redirect('/login');
}
})
```
Beitragsleitfaden
Rechercherichtung
Beginnen Sie beim app.get('*')-Callback und prüfen Sie die Integrationsanleitung des Repositorys für Express und Lambda@Edge. Ermitteln Sie, wie eine authentifizierte ViewerRequest ohne Redirect fortgesetzt werden sollte, und dokumentieren Sie das unterstützte Verhalten sowie ein klares Abschlussbeispiel.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- aws, express, javascript
- Bereich
- backend, cloud
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100