serverless-express icon indicating copy to clipboard operation
serverless-express copied to clipboard

Correct way to "do nothing"

Open pedroscaff opened this issue 3 years ago • 0 comments

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)?

// ... (passport / express setup)

app.get('*', (req, res) => {
	if (req.isAuthenticated()) {
		return; // What should come here?
	} else {
		res.redirect('/login');
	}
})

pedroscaff avatar Jul 14 '21 14:07 pedroscaff