@teqfw/web

0.23.0 • Public • Published

@teqfw/web

CAUTION: TeqFW is an unstable project w/o backward compatibility. Use it at your own risk.

This teq-plugin adds basic web server functionality to Tequila Framework based projects.

  • console commands to start/stop web server in HTTP/1.1, HTTP/2, HTTPS modes;
  • basic web requests processing with possibility to add various handlers;
  • requests handlers:
    • TeqFw_Web_Back_App_Server_Handler_Final: unprocessed requests responder;
    • TeqFw_Web_Back_App_Server_Handler_Static: GET requests for static resources;
    • TeqFw_Web_Back_App_Server_Handler_Config: GET requests to load various frontend configurations;

TODO

  • move the IndexedDB functionality to some external plugin (@teqfw/front-idb?)

Install

$ npm i @teqfw/web --save 

Namespace

This plugin uses TeqFw_Web namespace.

CLI commands

$ node ./bin/tequila.mjs help
Usage: tequila [options] [command]
...
Commands:
  web-server-start [options]  Start web server.
  web-server-stop             Stop web server.
$ node ./bin/tequila.mjs help web-server-start
... 
Options:
  -c, --cert <path>  certificates chain in PEM format to secure HTTP/2 server
  -1, --http1        use HTTP/1 server (default: HTTP/2)
  -k, --key <path>   private key in PEM format to secure HTTP/2 server
  -p, --port <port>  port to use (default: 8080)
  -s, --skipPid      don't save PID file (used for read-only filesystems like Google AppEngine)
  -w, --useWs        use web sockets with this server
  -h, --help         display help for command

./cfg/local.json

DTO for @teqfw/web node.

{
  "@teqfw/web": {
    "server": {
      "port": 8080,
      "secure": {
        "cert": "/path/to/cert.pem",
        "key": "/path/to/key.pem"
      },
      "useHttp1": false
    },
    "urlBase": "domain.com"
  }
}

teqfw.json

DTO for @teqfw/web nodes in teq-plugins descriptors.

{
  "@teqfw/web": {
    "doors": ["admin", "pub"],
    "excludes": {
      "handlers": ["Ns_Mod"]
    },
    "handlers": {
      "Ns_Mod": {
        "after": ["Ns_Mod"],
        "before": ["Ns_Mod"],
        "spaces": ["custom"]
      }
    },
    "statics": {
      "/url-path/": "/filesystem-path/"
    }
  }
}

Package Sidebar

Install

npm i @teqfw/web

Weekly Downloads

68

Version

0.23.0

License

Apache-2.0

Unpacked Size

154 kB

Total Files

64

Last publish

Collaborators

  • flancer32