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.
I was looking for a simple way to set up a status page or dashboard to monitor a REST Service and Web UI for teams to know the current status of application environments and health of the service. There are numerous ways and tools that you can use to achieve this but in this post, I’ll show you a really simple open source tool named greenyet.
greenyet is developed in Clojure and available as standalone JAR file. It polls the configured services for status information and gives a traffic light overview on the service health and availability.
You can dig the source code or simply use the JAR file with a minimal configuration.
Let’s see how to use greenyet to monitor a REST endpoint and Web UI. I have a demo app called das-boot and I want to set up a monitor for teams to monitor the Dev and QA environments.
The first step is to download the JAR file from https://github.com/cburgmer/greenyet/releases
Next, we need to setup couple of YAML configuration files –
This file lists all the hosts that you want to monitor. The list includes a name of the system or application, environment and hostname or IP. Here’s hosts.yaml for das-boot application:
- hostname: 192.168.10.101 environment: QA system: das-boot-service - hostname: 192.168.0.101 environment: QA system: das-boot-ui - hostname: 192.168.10.102 environment: Dev system: das-boot-service - hostname: 192.168.0.102 environment: Dev system: das-boot-ui
This file lists all the matching system entries from the host file and the endpoints. Here’s status_url.yaml for the das-boot application:
- system: das-boot-service url: http://%hostname%:9999/api/v1/ping - system: das-boot-ui url: http://%hostname%:9999/
Create these files in the same directory along with the downloaded JAR file and run following command:
java -jar greenyet-2.0.0-standalone.jar
This will launch the greenyet with default polling interval and port
Open a browser window and navigate to the greenyet. This will display a page similar to below screenshot
You can add more systems and configure additional options. Share this with the team or display on a TV monitor. Here is Raspberry Pi Touch displaying the greenyet monitor: