Host Static Web Application in Mirth

This blog is about how to host a static web application or a web page in Mirth and access it in browser

The logical understanding here is that – Mirth can send an data in HTTP Sender and Receive a data via HTTP Listener.

Basically Mirth can act as a application server by itself.

Example:

  • Just like how placing files on the “Htdocs” folder of the Apache works
  • How placing .war files on “Webapp” folder using Tomcat works
  • The same way placing HTML content on Mirth will also work

What the Application Does?

1. Select the channels, once you select the channels then click on submit.
2. It will post the data to the channel and get the statistics of the channel back to the application.

To achieve this I followed the below steps:

Step 1: (Create a simple SPA Angular App)

  • Write a simple Angular JS one page application. I’m using only Angular 1 for this purpose.
  • Put all CSS, JS libraries in the same file and call it as CDN url instead of referring them locally.
  • In the place of Post data, place the IP and PORT of the system which you need to send the data to.

Angular JS code:

MIRTH CHANNEL DASHBOARD

SELECT & CHECK

Message Format Type


–>

Post the above code and make it as “somefileName.html”.

Step 2: (Host Static Web Page In Mirth)

Now, for the channel logic, I’m using the same concept of getting the channel statistics from the dashboard as JSON.

  • Create a new channel and make source as HTTP Listener.
  • In the static resource area make the setup as shown in the screenshot below
Host-Angular-Application

Step 3: (Access the application through browser)

Deploy the hosted channel and then hit the below URL in your favorite browser. 
http://localhost:9887/index.html

Follow the above method and Host a static Web Application in Mirth instead of going to other application servers.

Leave a Comment