The Cloud Rover version 1.0.13 just released with new features and overall improvements. In this post I am gonna write about the improvements and new features I have added in the library
New Features
1. Schematic Routes
A schematic or wildcard path is kind of like a templated path that will accept anything as a subroute.
Suppose your route path is defined as
/user
. It's called an absolute path. Meaning request must match to
/user
to be considered as a valid path otherwise, request will hit a 404 response. We have another kind of route called dynamic route so you can pass a path like
/user/{id}
then a request to
/user/123
is valid and you get the id via the
params
interface. But it is limited to a single level of
/
.
The
schematic path
will be very useful when you need a full control over a url schema. For instance you define a path like
/proxy/*
and you get full control over the route i.e anything comes in place of the asterisk
(*)
. So suppose your requested path is
/proxy/xyz
this request will still hit the handler you defined for the path
/proxy/*
and from inside the handler you can actually read the requested
subpath
i.e the path in place of the
*
. We're calling it a subpath.
Learn More
2. Wildcard (*) Method
If you look at the method types you can see at the bottom there's a method type of
*
apart from the standard http methods. With the version
1.0.13
we've introduced a new type of method and we're calling it wildcard method. The idea is simple, this method will allow any incoming request of any method that's all you need to know.
Source
3. Official CORS Handling Support
Introduced a new way of handling CORS by passing a whitelist to the main
Rover()
object
Improvements
- Improved routing thus making it slightly more efficient.
-
Organized the old handler signature with
RC
or RouteContext interface for much simpler access. - Updated docs.
Potentials
With the support of Schematic Path and * Wildcard Method type cloud-rover is ready to be used as a fully functional reverse-proxy manager with multiple proxy paths. It can be used to proxy serverless services to hide secrets like Supabase.