# servess

> Easy request routing

Latest version **1.1.0** (published 2021-06-23) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-06-23 |
| First published | 2021-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 97.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Martin Hövre |
| Maintainers | poroshadows |
| Keywords | api, app, http, rest, restful, router, web |

## Links

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

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2021-06-23
- 1.0.1 — 2021-06-08

## README

# Servess

This is yet another routing library that takes some insperation from express and ktor. The module itself is a router with extension hooks. All routes are async.

A small example
```typescript
import createApp from 'servess'

void async function main() {
  const app = createApp()

  app.get('/', () => 'Hello, world!')

  await app.listen(3000)
  console.log('> Listening: http://localhost:3000')
}()
```

Content negotiation
```typescript
app.get('/', ctx => ctx.accepting({
  html: () => {
    ctx.setHeader('Content-Type', 'html')
    return `<p>Hello, world!</p>`
  },
  json: () => ctx.json({ hello: 'world' }),
  else: () => 'Hello, world'
}))
```

Extensions
```typescript
import createApp from 'servess'
// Type 1 static import
import Templating from 'servess-tmpl'

void async function main() {
  const app = createApp()

  app.install(Templating)
  // Type 2 dynamic import
  app.install(import('servess-ws'))

  await app.listen(3000)
  console.log('> Listening: http://localhost:3000')
}()
```

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