return { status: 123, headers: {}, body: "Hello" }
which is the manual way of making a response
(handler) => {
return async (request) => {
const userExists = await calltoDB(request.user)
if (!userExists) // return "you have to login!" immediately to client
return handler(request)
}
}
{ status: 123, headers: { ... }, body: "..." }
you get it? but people might find writing it the manual way tedious so that's why i included functions for creating it like response()
(handler) => { // <---- spirit calls this function
return async (request) => { // <-- this is the result of handler(request) / the previous middleware
const userExists = await calltoDB(request.user)
if (!userExists) return response("you have to login!")
return handler(request)
}
}
sendDate
property which you can set to false to disable this header. Don't recall how to access the vanilla response with spirit though, @hnry?