# @mkhizeryounas/autocode

> Simple function hosting framework.

Latest version **0.0.7** (published 2022-12-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mkhizeryounas/autocode
pnpm add @mkhizeryounas/autocode
yarn add @mkhizeryounas/autocode
bun add @mkhizeryounas/autocode
```

## 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.7 |
| Published | 2022-12-31 |
| First published | 2022-12-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14.16.1 |
| Dependencies | 7 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | mkhizeryounas |
| Maintainers | mkhizeryounas |

## Links

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

## Dependencies (7)

- [joi](https://npm.io/package/joi.md) ^17.7.0
- [cors](https://npm.io/package/cors.md) ^2.8.5
- [dotenv](https://npm.io/package/dotenv.md) ^16.0.1
- [morgan](https://npm.io/package/morgan.md) ^1.10.0
- [express](https://npm.io/package/express.md) ^4.18.2
- [cookie-parser](https://npm.io/package/cookie-parser.md) ^1.4.6
- [@mkhizeryounas/logger](https://npm.io/package/@mkhizeryounas/logger.md) ^1.0.4

## Recent versions

- 0.0.7 (latest) — 2022-12-31
- 0.0.6 — 2022-12-31
- 0.0.5 — 2022-12-31
- 0.0.4 — 2022-12-31
- 0.0.3 — 2022-12-31
- 0.0.2 — 2022-12-31

## README

# Autocode

Autocode is a simple function hosting framework. Now you don't need bulkey boilerplates to host simple HTTP routes.

Autocode exposes simple HTTP routes with the function names. Simply define your function and autocode will take care of exposing the route and it makes sure of parameter validation.

**Note**: Autocode is implemented on top of express so functions can also get access to express `Request` by just passing `request` keyword to the function defination

### Getting started

```shell
npm i @mkhizeryounas/autocode
```

```javascript
// example.js

const Autocode = require('@mkhizeryounas/autocode');

const autocode = new Autocode();

autocode.register(function onboardCompany(name, site, phone) {
  return { data: { name, site, phone } };
});

autocode.listen({ port: 3000 });
```

```shell
node example.js
```

**Request**

```shell
curl --location --request POST 'http://localhost:3000/onboardCompany' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Zigzag",
    "site": "www.gozigzag.com",
    "phone": "+17777777777"
}'
```

### Contributing

Feel free to submit pull requests.

### Authors

Khizer Younas - Initial work - [mkhizeryounas](http://github.com/mkhizeryounas)

### Licensing

The project is [MIT Licenced](./License.txt).

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