Skip to content

ygorbunkov/sse-mock

Repository files navigation

What is this?

Lightweight SSE mock-server configurable "on the fly" through the interactive CLI-prompt

Who is this for?

Front-end developers who might need to mock responses from the actual back-end with the data of their choice or whoever else who might find this useful

How do I use it?

  1. Clone the repo
git clone https://github.com/ygorbunkov/sse-mock.git
  1. Install the dependencies
yarn install
  1. Configure the environment (set necessary parameters within .env file)
  2. Create JSON-files in response directory (/src/response, by default) that will be used as a mock-data for Server Sent Events
  3. Start the server
yarn start
  1. When prompt is available in the terminal go to 'Configure endpoint subscription response'
  2. Specify route path (part that comes after root prefix) for your mock endpoint (e.g. /status-event to get http://localhost:3000/sse/status-event)
  3. Pick JSON-file from the list (it will be used as a data source for SSE)
  4. Whenever you need to push SSE event to the client hit 'Push Server Sent Event to the client' in the prompt
  5. Once you're done using the app hit 'Exit'

Can I use it without setting up Node.js environment?

Yes. However, you might need Docker Engine and Docker Compose for that.

You may either clone the repo (as suggested above), build Docker image locally and run it

docker-compose run ssemock

Or you may spin the latest image from the Dockerhub

Note: by default, your local ./response directory will be mounted as a Docker volume to ssemock container to host JSON-files with mock responses

About

SSE mock-server

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published