This module is responsible for exposing application-level APIs.
Check out the Administrative APIs section for information on administration-level requests.
This module provides a way for modules to register application routes for REST and GraphQL APIs.
Endpoint documentation is automatically generated so as to further facilitate development.
It also provides support for application-level WebSockets.
Just like mostly every other router out there, it does so by relying on three key concepts:
- Input Types
- Return Types
- Functional Handlers
- REST API (based on Express)
- GraphQL API
- Generated Documentation for REST with OpenAPI & Swagger
- Generated Documentation for GraphQL with built-in "description" functionality
- Parameter Validation
- Custom Middleware
This module requires no configuration.
|CONDUIT_SERVER||True||Conduit Core's address and port||0.0.0.0:55152|
|SERVICE_URL||False||This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS||0.0.0.0:56154|
|GRPC_PORT||False||Port to be used by the gRPC server||56154|
|CLIENT_HTTP_PORT||False||Port to be used by admin REST and GraphQL APIs||3000|
|CLIENT_SOCKET_PORT||False||Port to be used by admin WebSocket API||3001|
|GRCP_KEY||False||Specifying a secret enables gRPC signed request protection||someRandomSecret|
So how does one register their routes?
Before we elaborate on that, you should first consider the following:
Do I really need custom routes?
Modules automatically handle registering their routes for you.
Therefore, as long as you don't need additional functionality, you don't really need to worry about doing any of that yourself.
Routes are automatically registered or recovered upon bringing up a module, so make sure you start any of the modules you wish to experiment with before checking out Swagger or sending out any requests to these modules.
If you're simply trying to create CRUD endpoints for your database schemas, the answer is most likely "No".
The Database module already covers that use case as custom schemas enabling CRUD operations already come with auto-generated CRUD routes.
It also supports the creation of code-free custom endpoints for your schemas.
You can even accomplish that graphically through the Database section of the Admin Panel too!
I'm fairly sure I do
If you really need to write your own routes from the ground up, you're going to have to build your own custom modules.