appcd-http

HTTP server with WebSocket support, router, and various middlewares.

Usage no npm install needed!

<script type="module">
  import appcdHttp from 'https://cdn.skypack.dev/appcd-http';
</script>

README

appcd-http

Simple HTTP server with WebSocket support, router, and various common middlewares.

Built on top Koa.js.

Visit https://github.com/appcelerator/appc-daemon for more information.

Report issues to GitHub issues. Official issue tracker in JIRA.

Installation

npm i appcd-config

Usage

import WebServer from 'appcd-http';

const server = new WebServer({
    hostname: '127.0.0.1',
    port: 8080,
    webroot: '/path/to/webroot'
});

server.on('websocket', (conn, req) => {
    console.log('New WebSocket connection');
});

await server.listen();
console.log('Server started');

Add middleware with the use() method.

server.use(someMiddleware);

To stop the web server:

await server.shutdown();
console.log('Server stopped');

Legal

This project is open source under the Apache Public License v2 and is developed by Axway, Inc and the community. Please read the LICENSE file included in this distribution for more information.