1.0.4 • Published 7 years ago
turbo-server2 v1.0.4
turboServer
High Performance nodeJS HTTP server based on turbo-http
Request
The first parameter of the handler function is Request:
query- the parsed querystringbody- the body (?)params- the params matching the URLheaders- the headersid- the request idsupports- the clients supported web technologies (brotli, webp, ...)urlthe requested url
Response
The second parameter of the handler function is Response:
options- the options set for the route merged with server optionssend- sends the body to the client. It accepts Buffers, Strings and Objects/Arrays.
Options
Options can be set per app and request
with the setOptions method. It has 1 Argument that is an Object that can contain the following keys with boolen values except explictly specified:
- Example:
app.setOptions({gzip:true}) nocache- Cache-Control, Expires, Pragma headersxdeny- X-Frame-Options DENYxsameorigin- X-Frame-Options SAMEORIGINxxss- X-XSS-Protection 1; mode=blockxcontent- X-Content-Type-Options nosniffxdownload- X-Download-Options noopencors- \ Access-Control-Allow-Origincorsmethods- \ Access-Control-Allow-Methodshsts- Strict-Transport-Security max-age=31536000xdns- X-DNS-Prefetch-Control: true -> on, false -> offhideserver- hides the Server headerbrotli- enable brotli compressiongzip- enable gzip compressionetag- X-Frame-Options SAMEORIGIN