# saba

> Bare minimal HTTP webserver

Latest version **0.0.1** (published 2016-11-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install saba
pnpm add saba
yarn add saba
bun add saba
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2016-11-06 |
| First published | 2016-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | EGOIST |
| Maintainers | rem |
| Keywords | server |

## Links

- npm: https://www.npmjs.com/package/saba
- Repository: https://github.com/egoist/saba
- Homepage: https://github.com/egoist/saba#readme
- Issues: https://github.com/egoist/saba/issues
- npm.io page: https://npm.io/package/saba

## Recent versions

- 0.0.1 (latest) — 2016-11-06

## README

# Sāba

[![NPM version](https://img.shields.io/npm/v/saba.svg?style=flat-square)](https://npmjs.com/package/saba) [![NPM downloads](https://img.shields.io/npm/dm/saba.svg?style=flat-square)](https://npmjs.com/package/saba) [![Build Status](https://img.shields.io/circleci/project/egoist/saba/master.svg?style=flat-square)](https://circleci.com/gh/egoist/saba)

## Install

```bash
$ npm install --save saba
```

## Usage

```js
const {saba, send} = require('saba')

const app = saba((req, res) => {
  if (req.url === '/404') {
    return sned(res, 'not found', 404)
  }
  send(res, 'hello world')
})

app.listen(3000)
```

### Handle Error

```js
const handleError = fn => {
  return async (req, res) => {
    try {
      await fn(req, res)
    } catch (err) {
      // perform your logic here...
      console.log(err.stack)
    }
  }
}

saba(handleError(async (req, res) => {
  send(res, 'ready')
}))
```

## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## License

[MIT](https://egoist.mit-license.org/) © [EGOIST](https://github.com/egoist)

---
_Source: https://npm.io/package/saba · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
