Skip to main content

api check

Verifies that Optic can run your tasks and monitor traffic. When initializing Optic with your repository, the guided setup will have you run this command to validate the configuration. If there are any issues, they will be reported on the command line and in the Optic setup UI with recommendations on how to proceed. It takes the name of the task you wish to check, usually start:

Flags & Options#

This command takes no flags and has no options.

Examples#

Check a task configuration#

To check your start task configuration use:

api check start
[optic] Checking task start
Your command: node server.js --watch db.json --routes routes.json --port $PORT  โœ” Starts a long running process (your API)  โœ” On the host Optic assigns it $HOST (current: localhost)  โœ” On the port Optic assigns it $PORT (current: 3463)

Given this inboundUrl: http://localhost:3001  โœ” Optic proxy is able to start its proxy here localhost:3001
[optic] All Passed! This task is setup properly. Nice work![optic] To start this task, run: api start

Errors#

If api check runs into issues validating your task, it will report them:

[optic] Checking task start

Your command: echo "Setup A Valid Command to Start your API!"  โœ– Starts a long running process (your API)    โ†’ Your command exited early    On the host Optic assigns it $HOST (current: localhost)    On the port Optic assigns it $PORT (current: 3472)

Given this inboundUrl: http://localhost:4000  โœ– Optic proxy is able to start its proxy here localhost:4000    โ†’ Optic could not start here: localhost:4000
[optic] Some checks failed. Review the documentation here: https://useoptic.com/docs/get-started/config

Issues & Contributing#

Having trouble? Open an issue on GitHub

Have an idea for changing this command? Here's where it lives in the repo. PRs welcome!

Need help or want to talk with us about a use case? Join Contributing on Discord