Skip to content

Latest commit

 

History

History
93 lines (70 loc) · 3.23 KB

aphttp.md

File metadata and controls

93 lines (70 loc) · 3.23 KB

Access Point HTTP Servers

This file describes how HTTP servers were implemented for the jxmot/tessel-networking-example project.

Table of contents generated with markdown-toc

Related Documents:

Overview

This is a basic HTTP server, it is intended to be part of a larger project.

Features

  • Multiple instances, with :
    • Individual document root location
    • Optional custom path handlers
    • Shared common resource location
  • Small footprint

Use

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');

Details

The operation of the server is :

Application overview flow chart

Document Roots and Shared Resources

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.

Application overview flow chart

Resource Folder Hierarchy

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 

User Path Handler

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