v3.0.0
Update every route map to rouzer/http.
-import { route } from 'rouzer'
+import * as http from 'rouzer/http'
-export const profileRoute = route('profiles/:id', {
- GET: { response: $type<Profile>() },
- PATCH: { body: updateProfileSchema, response: $type<Profile>() },
+export const profiles = http.resource('profiles/:id', {
+ get: http.get({ response: $type<Profile>() }),
+ update: http.patch({ body: updateProfileSchema, response: $type<Profile>() }),
}) createRouter().use(routes, {
- profileRoute: {
- GET(ctx) { ... },
- PATCH(ctx) { ... },
+ profiles: {
+ get(ctx) { ... },
+ update(ctx) { ... },
},
})-await client.profileRoute.GET({ path: { id: '42' } })
+await client.profiles.get({ path: { id: '42' } })Also:
createClient({ routes })andcreateRouter().use(...)now take HTTP action/resource trees.- Keep
route(...)only for low-levelclient.request(...)/client.json(...)calls. ALLfallback routes and route-levelOPTIONShandlers are removed.@remix-run/route-patternis upgraded to v0.21.
Docs: https://github.com/alloc/rouzer/blob/v3.0.0/docs/context.md
Compare: v2.0.1...v3.0.0