isnode-mod-interface-http
v0.1.6
Published
ISNode HTTP interface
Downloads
1
Readme
ISNode HTTP Interface Module
Introduction
This is just a module for the ISNode Framework. To learn how to use the framework, we strongly suggest obtaining a copy of the Hello World example.
The HTTP interface module allows you to instantiate one or more HTTP or HTTPS (SSL) server interfaces. Each interface instance must be configured within the application server system configuration file and mappped to one or more routers, which are in turn mapped to one or more services.
Each instance of this interface must be bound to a free port on the system, as defined within the configuration file. Refer to the example below for how this might be configured.
There should not be any need to call any methods from this module, or interact with it in any way. It should simply operate automatically - as defined in system config.
Example
{
...
"interfaces": {
"http": {
"http1": {
"enabled": true,
"ssl": false,
"port": 80,
"requestTimeout": 60000,
"log": false,
"fileUploadPath": "./tmp/",
"maxUploadFileSizeMb": 50
},
"http2": {
"enabled": true,
"ssl": false,
"port": 8080,
"requestTimeout": 60000,
"log": false,
"fileUploadPath": "./tmp/",
"maxUploadFileSizeMb": 50
},
"https": {
"enabled": true,
"ssl": true,
"port": 443,
"requestTimeout": 60000,
"log": false,
"fileUploadPath": "./tmp/",
"maxUploadFileSizeMb": 50,
"key": "./config/key.pem",
"cert": "./config/server.crt"
}
}
}
...
}
Methods
get()
Synchronous Function. Returns an instance of the HTTP interface by name
Input Parameters:
- name - (String) Name of the interface, as defined within the system configuration file
Returns: (Object) The requested instance of the HTTP module.
Code example
// The below use case assumes that you have an instance of the isnode master object
var http1 = isnode.module("http", "interface").get("http1");
/*
There are no methods exposed by the HTTP interface instance object. You can listen for events (it is an event emitter object), or emit events against the object - but this is NOT recommended, as there should be no need to do so, and it could interfere with normal system operation.
That said, the "server" (raw HTTP server interface) and "listening" boolean are exposed as children of the interface object, so that other interface modules can determine the state of the interface and attach to the raw HTTP socket (for instance - a WebSockets interface module).
*/