Before deploying your API proxy to production, you need to make sure that it is thoroughly reviewed and tested. Static code analysis is an important procedure you can run that helps to ensure your code is consistent and clean. This process is known as _linting_, and Apigee API proxies can take advantage of an open-source tool called apigeelint. In this hands-on lab, we’ll take the preliminary steps necessary to run apigeelint, exporting our API proxy using the Apigee Edge Management APIs. Then, we’ll install apigeelint and use it to validate our code, displaying the results in a table format.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Export the API Proxy
- On the Apigee dashboard page, click API Proxies.
- Click the link for the proxy you want to analyze.
- Review the name and revision number.
- In your browser, navigate to https://apidocs.apigee.com/management/apis.
- In the Apigee Management APIs navigation menu, select API Proxies > Export API Proxy.
- Scroll down the page to the Resource URL section.
- Complete the Resource URL by filling in the following elements:
- Your organization name
- Your API proxy name
- Your proxy’s revision number
- In the HTTP Basic box, click Set…
- In the Set Authentication dialog, enter your Apigee email and password.
- Click Save.
- Click Send this request.
- Select the cURL tab.
- Copy the generated cURL command to your clipboard.
- In your terminal, paste the copied cURL command, and add the following:
-o ~/downloads/LAproxy.zip
- Install and Run apigeelint
- Change to your
Downloads
directory.
cd ~/downloads - Verify that the
LAproxy.zip
file is in the Downloads directory.
ls - Install apigeelint.
sudo npm install -g apigeelint - Enter your password at the prompt.
- Unzip the downloaded proxy.
unzip LAproxy.zip - Run apigeelint on the proxy folder.
apigeelint -s apiproxy/ -f table.js - Review the results.
- Change to your