Route Parameters, Middleware, and Groups
Learn how to define the route parameters, attach the middleware, and group routes.
We'll cover the following...
Route parameters
URL patterns in routes can contain parameters which are used to create dynamic routes.
'use strict' class ConvertEmptyStringsToNull { async handle ({ request }, next) { if (Object.keys(request.body).length) { request.body = Object.assign( ...Object.keys(request.body).map(key => ({ [key]: request.body[key] !== '' ? request.body[key] : null })) ) } await next() } } module.exports = ConvertEmptyStringsToNull
Press Run and wait for the output to be displayed in the Output tab. You may click on the link under the Run button and write anything in place of 1. We encourage you to try doing this.
Explanation
Take a look at ...