ZEN to Run a Local Static Server
While developing applications, learning to use a library or just testing out something quick, you might encounter the need to host your files in a “static” server — meaning that you just need an HTTP server to serve files as-is from a directory — . Nowadays, there are several simple options to get a static server running quickly.
Here ZEN is also does the same.
For all of the options below that use the command line, I’m assuming that you already entered the folder where your files are located. For example, if your code is in the folder “project”
/
|- project
|- index.html
|- js
|- main.js
You have to first enter to your “project” folder in the command line doing something like this:
cd project
First, you have to install zen cli tool, using below command:
npm i -g @ritikchoure/zen
After successfully installation, just hit the below command:
zen -vorzen --version
You’ll see output like this:
> 1.1.10
Now you can zen to serve your static files by using this command:
zen -serve
It starts server with default port 8080. If 8080 port is already in use you can use below command to serve on different port
zen -serve -p portnumber
You’ll see an output like this:
✓ Server listening on port 8080-------------------------------------------------------
Local: http://localhost:8080
External: http://192.168.43.110:8080
-------------------------------------------------------
It would automatically open your default browser at the Local URL shown above.
For more you can check out following links -
3. Author: Ritik Chourasiya
Let me know if you have any issue or any suggestion