3.0.1 • Published 6 years ago

@sasm/router v3.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

SasmRouter

HTTP Router for SASM

NPM Version Node Version Sasm Version SasmRouter Version

Install

npm i @sasm/router

Usage

Please see Sasm Version for information on how to use Sasm and extensions.

The router requires you to have a public directory for web files and a designated index HTML file in that directory.

For example, if your project is in a folder named "project", here is an example document tree layout for that directory:

project>
	package.json
	server.js
	public>
		index.html

With the default configuration left alone, the above document tree will work.

Configuration

You can, of course, change the defaults to your liking- and modify the public directory and default index filename. The default configuration is accessible under sasm.router. 1. public (string:directory): Public directory. Default: "/public" 2. index (string:HTMLfile): Default index file. Default: "index.html"

For example, if your document tree looks like the following:

project>
    package.json
    server.js
    publicHTML>
    	index.htm

Your server.js file could have the following code:

const sasm = require('@sasm/system');
const router = require('@sasm/router');
sasm.
	start().
	registerRoot(__dirname).
	registerExtension(router);
sasm.router.public = "/publicHTML"
sasm.router.index = "index.htm"
sasm.listen();
3.0.1

6 years ago

3.0.0

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago