Node.js framework for building applications (cli, server, etc...).
Matter In Motion transport extension for HTTP/S protocol.
npm i @matter-in-motion/trasnport
npm i @matter-in-motion/trasnports.http
- Add it to your extensions in the settings.
- Add settings
Message is simple object that get passed through app. By coming out of this transport it has this properties:
- url - instance of the URL class
- decodeBy - mime,
Content-Type
header - encodeBy - mime,
Accept
header - requestHeaders - http request headers with parsed cookies if avaliable
- requestMethod - http request method
- request - body of the request
- connection – http response
To sent response you can set following properties and use transport.send
method.
- response –
undefined
,null
,string
,Buffer
, orstream
- responseStatusCode – http response status code
- responseHeaders - response headers
- http/https - make just one
- server –
http.createServer
settings - listen –
http.listen
settings - static -
- url – static url
- root – static root directory
- setHeaders – function to set custom headers on response. Alterations to the headers need to occur synchronously.
- options – send module options
- server –
Minimal settings:
settings.http = {
listen: {
host: '0.0.0.0',
port: 3000
}
}
License: MIT.