This documentation is created using VitePress. Follow the steps below to add a new route to our application.
First, navigate to the appropriate clearing house folder and add the route. The available folders are:
/routes/abs/routes/bch/routes/chm/routes/common
Add the new route in the corresponding folder based on the type of route you are adding.
VitePress uses file-based routing, so you need to add the markdown file in the docs folder following the structure of your route.
For example, to add a route /ircc/document/get:
- Create a folder
irccinside thedocsfolder. - Inside the
irccfolder, create another folder nameddocument. - Inside the
documentfolder, create a markdown file namedget.md.
The folder structure should look like this:
docs/ └── ircc/ └── document/ └── get.md
In the get.md file, write the content required for the webpage.
Next, add the Swagger file for the playground specification. Place the Swagger JSON file inside the swagger/json folder. Ensure that the Swagger JSON file accurately reflects the API documentation for the new route.
Finally, reference and render the Swagger JSON file within the corresponding markdown file to display the API specification on the webpage. You can use VitePress's markdown capabilities to embed the Swagger UI.
By following these steps, you can successfully add new routes to your application and ensure that the API documentation is correctly displayed and functional.
To ensure the project runs correctly, you must set the following environment variables in your .env file located in the docs folder:
VITE_ACCOUNTS_HOST_URL=<your-accounts-host-url>
VITE_API_URL=<your-api-url>
You can find examples of these environment variables in the .env.example file located in the /docs directory.
Additionally, for the project to work, you need to have a launch configuration where the VITE_CLEARING_HOUSE value is set to the clearing house you are viewing. For example:
"VITE_CLEARING_HOUSE": "abs"Before running the project, make sure to install all necessary dependencies. Run the following command in your project directory:
npm installYou can start the development server for different clearing houses by using the following commands:
- For ABS:
npm run dev:abs- For CHM:
npm run dev:chm- For ABS:
npm run dev:bchThese commands will set the appropriate environment variable and start the VitePress development server.
To build the project for production, use the following command:
npm run buildThis will generate the static files for the documentation in the dist folder inside the docs directory.
After building the project, you can serve the static files using:
npm run serveThis will start a server to serve the built documentation locally.
By following these steps, you can run the project in development mode, build it for production, and serve the built documentation.