Servor is a Node.js tool designed to simplify the creation of local servers for web development.
With Servor, we can quickly spin up a development server without complications. It is designed to facilitate the setup and deployment of local servers.
Some of Servor’s features,
- Fast development server: Spins up a server with a single command line.
- Live reload: Automatically refreshes the browser when it detects changes in files.
- Minimal configuration: No need for complex configuration files.
For more information and documentation, you can visit the official Servor repository on GitHub. Here we will find additional details and usage examples that can help us get the most out of this tool.
How to Use Servor
Using Servor is quite straightforward. Let’s see how we can start a local server and take advantage of its features.
npm install -g servor
How to Run Servor
Installing Servor is a simple and quick process. First, we need to have Node.js and npm installed on our system. Once we have this configured, we can run Servor simply by doing
npx servor
This global installation allows us to use the servor command from anywhere in our terminal.
The complete syntax allows for more options
npx servor
root Path to serve static files (default, the current directory
.).fallback The file served for all requests that don’t match a file (default,
index.html).port The port from which files will be served (default, 8080).
Additionally, we can add the following parameters
| Option | Description |
|---|---|
--browse | Makes the browser open when the server starts. |
--reload | Makes the browser reload when files change. |
--secure | Starts the server with HTTPS using generated credentials. |
--silent | Prevents the Node server process from logging to stdout. |
--module | Makes the server wrap the root in module type tags in the script. |
--static | Makes the server route nested index files if they exist. |
--editor | Opens a code editor (currently only vscode) at the project root. |
How to Use Servor from NodeJS.
We can also run Servor directly from NodeJS. First, we need to add the package via
npm install servor
Now we can add Servor as an action to our package.json like this,
{ “devDependencies”: { “servor”: “4.0.0” }, “scripts”: { “start”: “servor www index.html 8080 —reload —browse” } }
We can also run it from our JavaScript code. For example, to start a basic server with Servor, we simply run the following command in our project directory:
const servor = require('servor');
const instance = await servor({
root: '.',
fallback: 'index.html',
module: false,
static: false,
reload: false,
inject: '',
credentials: null,
port: 8080,
});
This command will start a local server on port 8080 by default, serving static files from the current directory. We can access our application by opening http://localhost:8080 in our browser.

