To get started, you'll need the following:
We've created a repository of example API codebases in Node.js. Clone the repo to your local machine:
git clone https://github.com/nanoapi-io/nodejs-example-apis.git && cd nodejs-example-apis
For this tutorial, we will be exploring the express/basic
example.
cd express/basic
You can see more about this on the Getting Started page.
npm install -g @nanoapi.io/napi
napi init
napi ui
The NanoAPI UI allows you to view, move, and group the endpoints in your codebase. You can group the endpoints by clicking on the 3 dots to open the modal, then specifying the group name.
Note: Because of a bug in the UI, you will need to click the pencil icon to save the group name. We are working on this.
Once you exit the modal, you will see the project is out of sync with your source code in the bottom middle of the screen. Click on the orange sync button to update the changes.
Once the changes are synced, you can split the codebase by clicking on the build button in the bottom middle of the screen.
Alternatively, you can run the following command in your terminal:
napi split
You've now split your codebase into smaller, more manageable pieces! You can now run the split codebases as you would the original one.
If you have any questions, errors, or need help, feel free to reach out to us on Github by opening an issue.