Basic Patterns
Here are all the basic patterns that should be used with Byte.
Route splitting
Routes in different instances can be merged using app.route
.
You can use Byte.route()
as a shorthand of new Byte().route()
:
Code splitting
Code splitting can be done by de-coupling parts like middlewares or request handlers.
Byte.handle
is a wrapper to create functions which accepts a
request context as an argument.
These functions can be used as request handlers, validator methods or middlewares.
Byte.plugin
is a wrapper to create plugins.
Chaining
Chaining should be used if you need client type inference.
Chainable methods include use
, register
, route
, and all methods for registering request handlers.
Middlewares should be registered before handlers for readability.
Testing
See the testing client docs here.