Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gurpreetatwal/incito

Easiest way to turn a function into a web server!
https://github.com/gurpreetatwal/incito

axios integration middleware route supertest testing

Last synced: 1 day ago
JSON representation

Easiest way to turn a function into a web server!

Awesome Lists containing this project

README

        

incito


NPM Package
Build Status
Coverage

## Installation

```sh
npm install incito --save
```

```js
const incito = require('incito');
```

## Usage
### simple http server
```js
const server = incito();
const port = server.port;
```

### http server with listener
```js
function handle() {
// magical request handling code
}

const server = incito(handle);
```

### express http server
```js
const app = express();
const server = incito(app);
```

### koa http server
```js
const app = new Koa();
const server = incito(app.callback());
```

### other types of servers
```js
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'),
},
});