Easy Mock Services with AtmoPosted: June 15, 2018
In this post, I’ll introduce you to a super cool tool Atmo for simulating HTTP based APIs for development, testing, presentations or demos. You can consider Atmo as a Service Virtualization tool or a Mock server. Find out more about both the topics at https://www.infoq.com/articles/stubbing-mocking-service-virtualization-differences
There are many commercial service virtualization and open source tools & frameworks like SoapUI, Postman, MockServer, JSONServer, WireMock etc. available for creating Mock services or APIs. However, Atmo is my favourite because it is easy to setup and offers a highly intuitive user interface to define Mock services. You can either deploy a Mock service locally or in the cloud with Zeit.
Atmo is created by Raathigeshan Kugarajan. It comes in two flavours the original core built with React & JSONServer and the new standalone cross-platform Desktop version built with Electron and Express.
In this post, you will see how to use the Desktop version of Atmo for setting up a simple Mock service returning JSON response.
Download the Windows or Mac Desktop app from http://getatmo.com and launch the app.
Creating a Project
With Atmo you can create a project to logically group the Mock services. For example, you’re working on multiple projects and want to create set of Mock services for each one of these projects.
On launch, Atmo will display a Dialog with options to Create a new Project or Open a saved project.
For this example let’s create a new project called ToDo App
Define a Mock Service
After creating a new project Atmo will load an empty form to define a service. In this example, we will define an service or REST API endpoint to get a list of to-do items:
- In Url box enter todos
- Select GET operation from the drop-down
- Keep the default header for Content-Type. The Mock service will return a JSON list
- Select Response Type as JSON (you have a choice to return XML, Simple Text or Custom response)
- Select OK as Response Code (since this a GET method)
- Enter sample JSON response that will be returned by the Mock service
Now the newly defined service is ready to deploy.
Atmo can either deploy the newly created service on localhost or you can deploy in Zeit. Let’s deploy this on the localhost.
- Save the newly created service
- Click on Deploy option from the sidebar
- Once the service is deployed, Atmo will show the Url in the header section. You can click on the link (for example http://localhost:9000/todos). This will open the default Browser and call the GET method. The Browser should display the raw JSON returned by the Mock service.
You can now use this service endpoint to mock a dependency in your application.
Here’s step-by-step recording –
You can do much more than a simple GET service with Atmo. You can add more logic or secure services using advanced project settings. You can deploy the services in Zeit cloud to share with other developers.
Atmo has helped me immensely in my Development and Testing workflows to create prototypes of the services for UI development or Mock the third party APIs during the development & testing.
Update – Recently one of my colleagues pointed me to Mockoon. It has similar features as Atmo and super easy to setup.