Running APIs locally
The developer toolkit includes a Micro Gateway and a Node.js process manager that you use to test APIs and applications. You can optionally set a IBM® DataPower® Gateway Docker container to test more complex features.
Creating and running a service
Use the services
command to manage running processes for testing APIs and
applications. By default, the actions for the services
command work on the project
or directory where you executed the command, enabling you to manage services for multiple projects
concurrently and independently.
Some of the most common actions with the services
command are:
apic services
- List the local running services (alias forservices:list
).apic start
- Start the local services (alias forservices:start
).apic stop
- Stop the local services (alias forservices:stop
).apic stop --all
- Stop all services across all projects.
If you want to use the IBM DataPower Gateway Docker image for testing your API locally, see Testing APIs with the IBM DataPower Gateway for details.
The following procedure is a typical workflow to create a LoopBack® project, start the Micro Gateway and the Node.js server running the LoopBack application, and test the API using the endpoint exposed by the Micro Gateway.
-e
or --external
in the command, opens the Explore tool on 0.0.0.0
instead of the default 127.0.0.1. This option binds the server to all IP addresses on the machine,
and makes the tool accessible on the wider network.Viewing logs
When running services and testing APIs and applications, it's often useful to view the Micro Gateway and Node.js LoopBack logs by using the apic logs
command. For example:
Command | Description |
---|---|
apic logs |
View the logs for the default service (alias for services:logs) |
apic logs --service service_name |
Use apic services to list the service names. |
debug
- Include all messages in the log. This is the most verbose log level, and is useful for debugging.info
- Include messages of "info" level and more severe in the log.warning
- Include only messages of "warning" level or more severe in the log.error
- Include only messages of "error" level and more severe in the log.fatal
- Include only messages of "fatal" (the most severe) level in the log.