Last active
June 20, 2024 07:12
-
-
Save jordanwalsh23/40243d5f9837a2e01cab0b75cd4ea1f4 to your computer and use it in GitHub Desktop.
Run a Postman Mock Server on Localhost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const PostmanLocalMockServer = require('@jordanwalsh23/postman-local-mock-server'); | |
| const fs = require("fs"); | |
| const PORT = process.env.PORT || 3002; | |
| //Create the collection object. | |
| let collection = JSON.parse(fs.readFileSync('./collection.json', 'utf8')); | |
| //Create a new server | |
| let server = new PostmanLocalMockServer(PORT, collection); | |
| //Start the server | |
| server.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment