Thanks for answering @g45t345rt! And yeah @socketopp, definitely possible :)
Middleware is literally any function that either:
responds with anything (breaks the response chain)... usually a Response unless you have something to catch the lack of Response downstream
doesn't response (continues to handle other middleware/handlers until one does). This is how you would handle auth for instance... perhaps embedding the user into the request for future handlers, or conversely responding early with a 401 Response.
Is it possible to write middleware that accepts parameters like my example below?
router.post('/ping', parseRequest('id123'), async (request, env) => {}