# @amacl/roboc-api

> package based on express for api

Latest version **1.0.2** (published 2020-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @amacl/roboc-api
pnpm add @amacl/roboc-api
yarn add @amacl/roboc-api
bun add @amacl/roboc-api
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-06-05 |
| First published | 2020-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 20.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pablo Rebolledo Acosta |
| Maintainers | pablo.rebolledo.acosta |

## Links

- npm: https://www.npmjs.com/package/@amacl/roboc-api
- Repository: https://github.com/amacl/roboc-api
- Homepage: https://github.com/amacl/roboc-api#readme
- Issues: https://github.com/amacl/roboc-api/issues
- npm.io page: https://npm.io/package/@amacl/roboc-api

## Dependencies (5)

- [esm](https://npm.io/package/esm.md) ^3.2.25
- [express](https://npm.io/package/express.md) ^4.17.1
- [body-parser](https://npm.io/package/body-parser.md) ^1.19.0
- [compression](https://npm.io/package/compression.md) ^1.7.4
- [microbundle](https://npm.io/package/microbundle.md) ^0.12.0

## Recent versions

- 1.0.2 (latest) — 2020-06-05
- 1.0.1 — 2020-06-05
- 1.0.0 — 2020-04-17

## README

# @amacl/roboc-api

Package based on express for api

## Install

```sh
$ npm install @amacl/roboc-api
```

## Use

In your index.js

```js
import api from '@amacl/roboc-api'

api({
    prefix: process.env.API_PREFIX || '/',        
    port: process.env.PORT || 3000,
    host: process.env.HOST || '0.0.0.0',
    alive: '/alive',
},(router) => {

    router.get('/', (req, res, next) => {
        res.status(200).json({
            OK:true, 
            message: "hello api"
        })        
    })

    return router
})
```

```sh
$ curl -v http://localhost:3000/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Content-Type: application/json; charset=utf-8
< Content-Length: 26
< ETag: W/"1a-TKkgpyRywm3emcPTHBvpWMDkwaE"
< Vary: Accept-Encoding
< Date: Thu, 09 Apr 2020 02:27:57 GMT
< Connection: keep-alive
<
* Connection #0 to host localhost left intact
{"OK":true, message: "hello api"}
```

## Tests
```sh
$ npm test
```

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