appcd-http

2.0.7 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i appcd-http

Weekly Downloads

16

Version

2.0.7

License

Apache-2.0

Unpacked Size

76.5 kB

Total Files

9

Last publish

Collaborators

  • cb1kenobi
  • awam
  • tisdk