Quick Concepts
Jargon
Routes
Methods that can be called remotely and have an URL assigned.
Hooks
Auxiliary or (middleware) functions that get executed before or after a route. Hooks can send/receive data but can not be called directly.
Execution Path
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.
Call Context
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.
Runtime Types
mion uses Deepkit's runtime types for automatic validation and serialization. When typescript gets compiled extra bytecode is generated containing type metadata that can latter can be accessed at runtime and used for validation, serialization and many more things.
RPC vs REST
Some advantages of an RPC architecture:
- Type Safety
- Fewer 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)