This file describes how HTTP servers were implemented for the jxmot/tessel-networking-example project.
Table of contents generated with markdown-toc
Related Documents:
This is a basic HTTP server, it is intended to be part of a larger project.
- Multiple instances, with :
- Individual document root location
- Optional custom path handlers
- Shared common resource location
- Small footprint
Here is a simple example of how the server might be used :
const httpsrv = require('./tessel-ap-http.js');
var http = new httpsrv('192.168.1.101', 80, 'www');
The operation of the server is :
Each instance of the HTTP server shares a common resource path in addition to the instance specific resource path. The server will automatically seek the requested resource in both paths. If the resource is not found the server will respond with a 404
page.
Here is how the HTTP folders are arranged for the jxmot/tessel-networking-example project:
\ ------+ *.js - Project files
|
|
+- public --+-- 404.html
|
+-- assets ---+
| |
| + css -- 404.css
|
|
+-- www ------+-- index.html, favicon.ico
| |
| +-- assets -+
| + img -- tessel.png
|
|
+-- wwwadmin -+-- index.html, favicon.ico
|
+-- assets -+
+ css -- index.css
|
+ img -- tessel.png
Each instantiation can optionally have a user path hander associated with it. This allows for customization of the files served and API endpoints by the user of the module.
© 2018 J.Motyl