3.1.2 • Published 7 years ago

ezserver v3.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

EZServer

travis build version license

EZServer is a simple static server.

Download

$ npm install --save ezserver

Usage

Create a server

The EZServer class creates a single server object which it will return. The EZServer constructor takes an optional configuration object that can contain three properties (all of which are optional). The properties that can be provided are a root path, a port, and whether console logging should be on or off. The root path will default to the directory where the server is created, the port will default to 3000, and logging will default to true.

const EZServer = require('ezserver');
const config = {
  rootPath: './public',
  port: 8000,
  logging: true
};
const server = new EZServer(config);

Starting and Stopping The Server

Once the server has been created, starting and stopping the server is as simple as calling the start and stop methods on the server object.

server.start();
server.stop();

Logging

Console logging is turned on be default at server creation, however it can be explicitly set on or off by setting the the logging property on the optional configuration object, passed to the server constructor.

const EZServer = require('ezserver');
const server = new EZServer({ logging: true });

Below is an example of how the logging will look when turned on:

logging example

3.1.2

7 years ago

3.1.1

7 years ago

3.1.0

7 years ago

3.0.0

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago