Methods that can be called remotely and have an url assigned.
Auxiliary or (middleware) functions that get executed before or after a route. Hooks can send/receive data but can not be called directly.
Ordered list of all the methods to be executed when calling a route. Each execution path can contain multiple Hooks but a single Route method.
The context passed to every route or hook method, contains data like request, response, and shared data. It is always the first parameter of any route or hook handler.
mion uses Deepkit's runtime types for automatic validation and serialization. When typescript gets compiled extra bytecode is generated containing type metadata that can be accessed at runtime.
Some advantages of an RPC architecture:
- Type Safety
- Less abstractions
- Better client-server integration
For more detailed insights into different API types and their pros and cons, check out Nate Barbettini's presentation (API Throw-down: RPC vs REST vs GraphQL)