First, create a new folder for routes.
Copilot helps generate a default schema which we can adjust according to our needs. Here’s a basic setup.
Ensure our base URL and routes align with our application's needs. Typically, we use Express with mongoose models.
For example, in our companies route, we deal with the GET, POST, PUT, and DELETE requests.
While Copilot is helpful, sometimes it may not understand the complete context. Make sure to verify and adjust the generated code.
Handling Defaults: Ensure fields like version
and shares
have default values.
Validation and Logic: Align to best practices and handle validation rigorously.
Finally, always review the code to align it with best practices and ensure it adheres to your application's needs.
For any remaining issues, Copilot can suggest fixes. We'll dive deeper into these fixes in a later section.