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!
Advertisements

How to convert tabs to spaces in Notepad++

So, the very first project that I was exposed on, as a professional, included, among others, YAML and as you obviously know YAML has a strict syntax.

Notepad++ is till now, my favourite editor, but it comes without something that is very useful to the case that we ‘re investigating today, a “Tabs to Spaces” plugin/feature (I found that the one provided under the Edit -> Blank Operations menu was missing basic functionality). 

There is a solution, though, come along!

  • First of all, we have to download the plugin.
  • We then copy the CLRTabsToSpaces.dll from the .zip file that we just downloaded into \path\to\Notepad++\installation\plugins folder.
  • If Notepad++ is open, we have to close it and restart it again, in order to let the software track the changes.
  • Navigating to the “Plugins” menu, we should see something like below:

That is, we have set properly our plugin, so to get it working, we just follow the above screenshot, to get the tab characters be converted into spaces.
Note: it’s better to edit such code snippets, having enabled the “Show all characters” button: 
And a small example (sample code from here ):

Before applying the plugin.

After applying the plugin.


Cheers!