mock API from OpenAPI spec
ok, using openapi.yaml and create mock server using prism mock testing with postman
You can quickly create a mock API from your OpenAPI spec using Prism (a popular open-source tool). Here’s how to do it on Windows:
- Install Prism globally (if you have Node.js installed) Open your terminal and run:
npm install -g @stoplight/prism-cli
- Run the mock server Navigate to your OpenAPI file directory: cd f:\code\web\learning-platform-laravel\doc\api
Start the mock server: prism mock openapi.yaml
- Access your mock API By default, Prism will start a server at http://127.0.0.1:4010. You can now make requests to endpoints like:
POST http://127.0.0.1:4010/users GET http://127.0.0.1:4010/users/1 Prism will return mock responses based on your OpenAPI spec.
👉 Tip: You can import openapi.yaml directly into Postman to auto-generate all request collections (no need to create requests manually).
In Postman → Import → Upload openapi.yaml.
Written on September 16, 2025