CodeGenieApp / CodeGenieApp/serverless-express

Correct way to "do nothing"

Open
#434 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.3k
Forks
676
PR merge metrics
No merged PRs in 30d

Description

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');
}
})
```

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.