When you first setup Optic, a
start task is added to your
optic.yml file. The start task can be run using
name: Todo APItasks:start:command: npm run server-startbaseUrl: 'http://localhost:3005'
You may also want a quick way to run your API tests, a Postman collection, etc through Optic. To make this simple, Optic lets you define as many custom tasks as you'd like:
name: Todo APItasks:start:command: npm run server-startbaseUrl: 'http://localhost:3005'test:command: npm run testAPIbaseUrl: 'http://localhost:3005'
Each custom task is run with
api run <task name> ie
api run test
As you use Optic, you will probably realize there are some paths you'd like Optic to ignore. Examples include
.css files, or everything in your
/public * folder.
You an add ignore rules to your
name: Todo APItasks:start:command: npm run server-startbaseUrl: 'http://localhost:3005'ignoreRequests:- OPTIONS * # Ignores all options requests- GET /public/**
Rules are formatted like this:
You can add a list of methods ie
GET POST PUT, use a single method ie
GET and if you do not specify a method Optic will match them all.