Testing Locally

There are two ways that you can run a service before you deploy it to build. Either from the command line using api dev or through code by running api link to link the local service to code running elsewhere on your computer.

api dev

Running api dev in a folder containing a service will run it without requiring it to be deployed. Simply pass the action name and the data you want to pass in.

api dev multiply x=10 y=20

api link

If you want to test a service with actual code, you can set up a link between the local service and any other node project. The api for this is very similar to npm link.

  1. Run api link in the service that you want to test. This will let the api module in the other project know where to look for it.
  2. Run api link {service name} in the directory you to test it out in.
  3. When you use the service as normal in that project, it will make a call to the local service instead of making a call to Build.