2.2.2 • Published 3 months ago

@gibme/webserver v2.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Simple Express.js Application Wrapper

This wrapper makes it very easy to construct a new instance of an Express.js web server application using HTTP or HTTPs.

Features include:

  • Preloaded recommended headers (optional)
  • Automatic 404 handling (optional)
  • Compression (optional)
  • Auto-parsing of request bodies
  • WebSocket via additional method signature of .ws('path', (socket, request) => void)
  • Auto-generation of development SSL certificates for the hostnames supplied and installing a development root CA into the host OS.
    • Note: This mode is NOT for production use
  • Simple cloudflared support to spin up test tunnels using Cloudflare
    • Note: The public URLs will be randomly generated by Cloudflare

Documentation

https://gibme-npm.github.io/webserver/

Sample Code

import WebServer, { Logger } from '@gibme/webserver';

(async() => {
    const app = WebServer.create({
        autoStartTunnel: true
    });
    
    app.get('/', (request, response) => {
        return response.json({ success: true });
    })

    app.ws('/wss', (socket) => {
        socket.on('message', msg => {
            // simply echo the message back
            socket.send(msg);
        });
    });
    
    await app.start();
    
    Logger.info('Listening on: %s', app.localUrl);
    Logger.info('Listening on: %s', app.tunnelUrl);
    Logger.info('Listening on: %s', app.url);
})();
2.2.2

3 months ago

2.2.1

3 months ago

2.2.0

5 months ago

2.1.2

5 months ago

2.0.3

9 months ago

2.0.2

9 months ago

2.1.0

9 months ago

2.0.1

9 months ago

2.0.0

10 months ago

1.0.8

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago