Skip to content

Easiest way to turn a function into a web server!

License

Notifications You must be signed in to change notification settings

gurpreetatwal/incito

Repository files navigation

incito

NPM Package Build Status Coverage

Installation

npm install incito --save
const incito = require('incito');

Usage

simple http server

const server = incito();
const port = server.port;

http server with listener

function handle() {
  // magical request handling code
}

const server = incito(handle);

express http server

const app = express();
const server = incito(app);

koa http server

const app = new Koa();
const server = incito(app.callback());

other types of servers

const server = incito({
  type: 'https',
  listener: app
  options: {
    key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
    cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
  },
});