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: 6 months ago
JSON representation
Easiest way to turn a function into a web server!
- Host: GitHub
- URL: https://github.com/gurpreetatwal/incito
- Owner: gurpreetatwal
- License: mit
- Created: 2016-10-29T06:11:46.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-12-28T03:03:35.000Z (almost 2 years ago)
- Last Synced: 2024-04-15T02:08:43.841Z (over 1 year ago)
- Topics: axios, integration, middleware, route, supertest, testing
- Language: JavaScript
- Homepage:
- Size: 1.14 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
incito
## 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'),
},
});