Sunday, July 27, 2014

How to setup Mongoose Web Server: a really lightweight one

Developing web applications always requires a web infrastructure, in order to test them, before getting them into production, but many times, we just want our app to consume a web service (that is, to be working as a client), so the requirements for a web server are very lightweight.

If we aren't familiar with web servers and similar stuff and we just want to quickly setup a server in order to test our web app's functionality, Mongoose is here to give the answer, as it's the most easy to setup and use web server in the market.

To quickly download and set it up, come along:

  1. Visit this link and download the Windows Executable that corresponds to free edition:
  2. Add the directory path of the executable in the environmental variable called "Path" (if you need more assistance getting over this, please refer here); for example, my executable's absolute path is C:\Thodoris\Servers\mongoose-5.3.5\bin\mongoose.exe, so I should add C:\Thodoris\Servers\mongoose-5.3.5\bin in my "Path".
Good to go, just navigate to the working directory (folder) of your project, through command line and type mongoose; this produces a web server that runs and serves that folder as the web root.

Regarding the simple web apps that I'm developing over time for educational purposes,  I have set a global "mongoose" folder, where I place all the required assets. It lies under C:\Thodoris\Workspaces\mongoose directory andhere is a dummy view of it:


So, let me run my server:


After successful execution of the command, server root in the default browser:

And it's not over. If you 're aware of host's IP address, you can ping it from any other device, connected in your LAN!

Cheers!

No comments:

Post a Comment