0.4.0 • Published 5 years ago

stattic v0.4.0

Weekly downloads
28
License
MIT
Repository
github
Last release
5 years ago

stattic

npm npm Dependency Status npm

Ridiculous simple script for serving static files using http module.

Installation

Install it using NPM:

npm install stattic --save

Usage

Example of a very simple server that shows all the static files on the public folder:

//Import stattic
let stattic = require("stattic");

//Run the web server
stattic({
    "folder": "./public",
    "port": 5000
});

API

stattic(options)

Starts a new server with the configuration specified in the options object. The following table lists the available options:

keyDescriptionTypeDefault value
folderSets the path of your static files folder.String./
portSets the port of your server.Integer5000
corsEnable cross-origin resource sharing (CORS).Booleanfalse
indexSets the index file name.Stringindex.html

CLI usage

You can install the CLI by running the following command:

npm install -g stattic

Now you can navigate to a folder with your static files and initialize a static server:

cd /path/to/your/static/content/
stattic --port 5000 --cors

This will start a new static server in the port 5000 that will serve all files placed in the current folder.

CLI options

--port PORT

Specify the port for your static server. Default is 5000.

--folder FOLDER

You can specify a different folder to serve the static files. Example

stattic --port 5000 --folder /path/to/your/static/content/

--cors

Use this option to enable cors.

License

MIT LICENSE © Josemi Juanes.

0.4.0

5 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.7

7 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago