npm package: @rster/builder
Description: RSTER is a toolset for REST Api creation
Author: Nicolas Schmidt
Latest version: 0.1.9

<a name="readme-top"></a>

[![Github Shield][github-shield]][github-url]
[![NPM Shield][npm-shield]][npm-url]
[![Documentation][documentation-shield]][documentation-url]
[![TypeDoc][typedoc-shield]][typedoc-url]

[![Build Status][build-shield]][build-url]
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![BSD-3-Clause][license-shield]][license-url]
[![NPM][version-shield]][npm-url]
[![Downloads][downloads-shield]][npm-url]
[![Coverage][coverage-shield]][coverage-url]

<!-- PROJECT LOGO -->
<br />
<div align="center">
  <a href="https://github.com/nsc-de/rster">
    <img src="https://raw.githubusercontent.com/nsc-de/rster/master/images/%40rster/logo.png" alt="Logo" height="80" className="height-80px" />
  </a>
  <a href="https://github.com/nsc-de/rster">
    <img src="https://raw.githubusercontent.com/nsc-de/rster/master/images/%40rster/slash.png" alt="Logo" height="80" className="height-80px" />
    </a>
    <a href="https://github.com/nsc-de/rster/tree/master/packages/builder">
    <img src="https://raw.githubusercontent.com/nsc-de/rster/master/images/%40rster/package-builder.png" alt="Logo" height="80" className="height-80px" />
  </a>

  <h3 align="center">@rster/builder</h3>

  <p align="center">
    <font color="red">
build
</font> design your backend
    <br />
    <a href="https://nsc-de.github.io/rster/"><strong>Explore the docs »</strong></a>
    <br />
    <br />
    <a href="https://github.com/nsc-de/rster">View Demo</a>
    ·
    <a href="https://github.com/nsc-de/rster/issues">Report Bug</a>
    ·
    <a href="https://github.com/nsc-de/rster/issues">Request Feature</a>
  </p>
</div>

<!-- TABLE OF CONTENTS -->

## Table of Contents

<!-- TABLE OF CONTENTS -->
<details>
  <summary>Table of Contents</summary>
  <ol>
    <li>
      <a href="#about-the-project">About The Project</a>
      <ul>
        <li><a href="#built-with">Built With</a></li>
      </ul>
    </li>
    <li><a href="#contributing">Contributing</a></li>
    <li><a href="#license">License</a></li>
    <li><a href="#contact">Contact</a></li>
  </ol>
</details>

## About The Project

`@rster/builder` is a package of the `@rster` project. It is build on top of the basic rster api to make the definition of your api easier. It does type-checking for you. This is better for security reasons and you will save a lot of time and effort. Find tutorials and documentation on the [rster website](https://nsc-de.github.io/rster/). The package is available on [npm](https://www.npmjs.com/package/@rster/builder).

[rster repository](https://github.com/nsc-de/rster)
·
[rster package on npm](https://www.npmjs.com/package/@rster/builder)
·
[rster documentation](https://nsc-de.github.io/rster/)

<p align="right">(<a href="#readme-top">back to top</a>)</p>

## A demo of the builder

```typescript
import { api, module, method } from "@rster/builder";
import { undefinedType, string, array, object, number } from "@rster/types";
import "@rster/worker-express";
import express from "express";

const users: {
  name: string;
  age: number;
}[] = [];

const API = api(
  "api",
  ["a simple demo api"],
  {
    users: module(
      "users",
      ["module to handle users"],
      {},
      {
        create: method(
          "create",
          ["create a user"],
          {
            expectBody: {
              name: { required: true, type: string() },
              age: { required: true, type: number() },
            },
            returns: undefinedType(),
          },
          "/users",
          "post",
          ({ age, name }) => {
            users.push({ age, name });
          }
        ),

        list: method(
          "list",
          ["list users"],
          {
            returns: array(
              object({
                name: { type: string(), required: true },
                age: { type: number(), required: true },
              })
            ),
          },
          "/users",
          "get",
          () => users
        ),
      }
    ),
  },
  {}
);

const rster = API.rest();

const app = express();
app.use(rster.express());

app.listen(3000, () => {
  console.log("listening on port 3000");
});
```

[More examples on the rster website](https://nsc-de.github.io/rster/docs/tutorial/intro/rster-builder)

### Built With

[![typescript][typescript-shield]][typescript-url]
[![nodejs][nodejs-shield]][nodejs-url]
[![npm][npm-package-manager-shield]][npm-package-manager-url]
[![eslint][eslint-shield]][eslint-url]
[![jest][jest-shield]][jest-url]
[![turbo][turbo-shield]][turbo-url]
[![changesets][changesets-shield]][changesets-url]

- [typescript][typescript-url]
- [nodejs][nodejs-url]
- [npm][npm-package-manager-url]
- [eslint][eslint-url]
- [jest][jest-url]
- [turbo][turbo-url]
- [changesets][changesets-url]

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- CONTRIBUTING -->

## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- LICENSE -->

## License

Distributed under the BSD-3-Clause License. See `LICENSE` for more information.

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- CONTACT -->

## Contact

<!-- Nicolas Schmidt &#60;[@nsc-de](https://github.com/nsc-de/)&#62; -->

[![twitter][contact-twitter-shield]][contact-twitter-url] [![github][contact-github-shield]][contact-github-url]

Project Link: [https://github.com/nsc-de/rster/tree/master/packages/authorization](https://github.com/nsc-de/rster/tree/master/packages/authorization)

[![GitHub][github-shield]][github-url]

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- link shields -->

[github-shield]: https://img.shields.io/badge/github-grey?style=for-the-badge&logo=github
[github-url]: https://github.com/nsc-de/rster/tree/master/packages/builder
[npm-shield]: https://img.shields.io/badge/npm-red?style=for-the-badge&logo=npm
[npm-url]: https://www.npmjs.com/package/%40rster/builder
[typedoc-shield]: https://img.shields.io/badge/typedoc-darkblue?style=for-the-badge&logo=typescript
[typedoc-url]: https://nsc-de.github.io/rster/docs/api-reference/builder/
[documentation-shield]: https://img.shields.io/badge/documentation-blue.svg?style=for-the-badge&logo=github
[documentation-url]: https://nsc-de.github.io/rster/

<!-- Info Shields -->

[forks-shield]: https://img.shields.io/github/forks/nsc-de/rster.svg?style=for-the-badge
[forks-url]: https://github.com/nsc-de/rster/network/members
[stars-shield]: https://img.shields.io/github/stars/nsc-de/rster.svg?style=for-the-badge
[stars-url]: https://github.com/nsc-de/rster/stargazers
[issues-shield]: https://img.shields.io/github/issues/nsc-de/rster.svg?style=for-the-badge
[issues-url]: https://github.com/nsc-de/rster/issues
[license-shield]: https://img.shields.io/github/license/nsc-de/rster.svg?style=for-the-badge
[license-url]: https://github.com/nsc-de/rster/blob/master/LICENSE.txt
[build-shield]: https://img.shields.io/github/actions/workflow/status/nsc-de/rster/ci.yml?style=for-the-badge
[build-url]: https://github.com/nsc-de/rster/actions/workflows/ci.yml
[contributors-shield]: https://img.shields.io/github/contributors/nsc-de/rster.svg?style=for-the-badge
[contributors-url]: https://github.com/nsc-de/rster/graphs/contributors
[version-shield]: https://img.shields.io/npm/v/@rster/builder?style=for-the-badge
[downloads-shield]: https://img.shields.io/npm/dt/@rster/builder?style=for-the-badge
[coverage-shield]: https://img.shields.io/codecov/c/github/nsc-de/rster?style=for-the-badge
[coverage-url]: https://codecov.io/gh/nsc-de/rster

<!--Build With-->

[typescript-shield]: https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white
[typescript-url]: https://www.typescriptlang.org/
[npm-package-manager-shield]: https://img.shields.io/badge/npm-red?style=for-the-badge&logo=npm&logoColor=white
[npm-package-manager-url]: https://www.npmjs.com/
[express-shield]: https://img.shields.io/badge/Express.js-404D59?style=for-the-badge
[express-url]: https://expressjs.com/
[jest-shield]: https://img.shields.io/badge/-Jest-C21325?style=for-the-badge&logo=jest&logoColor=white
[jest-url]: https://jestjs.io/
[nodejs-shield]: https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=node.js&logoColor=white
[nodejs-url]: https://nodejs.org/en/
[eslint-shield]: https://img.shields.io/badge/eslint-4B32C3?style=for-the-badge&logo=eslint&logoColor=white
[eslint-url]: https://eslint.org/
[turbo-shield]: https://img.shields.io/badge/turbo-000000?style=for-the-badge&logo=turbo&logoColor=white
[turbo-url]: https://turbo.build/
[changesets-shield]: https://img.shields.io/badge/changesets-1E1E1E?style=for-the-badge&logo=changesets&logoColor=white
[changesets-url]: https://github.com/changesets/changesets

<!-- Contact Shields -->

[contact-twitter-shield]: https://img.shields.io/badge/@nsc_dev-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white
[contact-twitter-url]: https://twitter.com/nsc_dev
[contact-github-shield]: https://img.shields.io/badge/@nsc--de-100000?style=for-the-badge&logo=github&logoColor=white
[contact-github-url]: https://github.com/nsc-de/