Advanced Routes
DinoSsr is an experimental work in progress and subject to change!
DinoSsr is built upon
VelociRouter. The request
and
response
are passed through all matching handles. Routes
can also be JavaScript or TypeScript files exporting a handle. The same file
path and URL pattern matching is applied.
JavaScript routes can export a GET
function.
routes/(all)/index.js
export const pattern = '/*';
export const order = 999;
export const GET = async (props) => {
if (props.response) {
props.response.headers.set('x-powered-by', 'DinoSsr');
}
};
DELETE
, PATCH
, POST
, and
PUT
are also supported matching their respective HTTP methods.
The optional order
export gives an explicit
order to assign the handle. If no order
is exported routes are handled
in the order they're discovered.
Parameters
See the VelociRouter documentation
for all props
passed to the handle function.
platform
Includes the follow properties:
platform.info
The ServeHandlerInfo
for the request.
platform.deployHash
The current DinoSsr deploy hash (useful for cache busting, etc).
platform.cookies
A Map
object to read, set, or delete cookies in the response header.
platform.publicData
An object to read and assign context data.
platform.serverData
An object to read and assign context data.