# endurance-js

> Create API resources for Next.js

Latest version **0.0.21** (published 2022-11-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install endurance-js
pnpm add endurance-js
yarn add endurance-js
bun add endurance-js
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.21 |
| Published | 2022-11-30 |
| First published | 2022-11-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 41.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Álvaro Jáuregui |
| Maintainers | capiloky |
| Keywords | next |

## Links

- npm: https://www.npmjs.com/package/endurance-js
- Repository: https://github.com/capiloky/endurance-js
- Homepage: https://github.com/capiloky/endurance-js#readme
- Issues: https://github.com/capiloky/endurance-js/issues
- npm.io page: https://npm.io/package/endurance-js

## Dependencies (1)

- [yup](https://npm.io/package/yup.md) ^0.32.11

## Recent versions

- 0.0.21 (latest) — 2022-11-30
- 0.0.17 — 2022-11-29
- 0.0.16 — 2022-11-29
- 0.0.15 — 2022-11-29
- 0.0.14 — 2022-11-28
- 0.0.13 — 2022-11-28
- 0.0.12 — 2022-11-28
- 0.0.11 — 2022-11-28
- 0.0.10 — 2022-11-28
- 0.0.9 — 2022-11-28
- 0.0.8 — 2022-11-28
- 0.0.7 — 2022-11-28
- 0.0.6 — 2022-11-28
- 0.0.5 — 2022-11-28
- 0.0.4 — 2022-11-28
- … 3 more at https://npm.io/package/endurance-js/versions

## README

<p align="center">
   <h3 align="center">Endurance.js</h3>
   <p align="center">Api Resources for Next.js</p>
   <p align="center">
   Open Source. Full Stack. Own Your Data.
   </p>
   <p align="center" style="align: center;">
      <a href="https://packagephobia.com/result?p=endurance-js">
        <img src="https://packagephobia.com/badge?p=endurance-js" alt="Bundle Size"/>
      </a>
      <a href="https://www.npmtrends.com/endurance-js">
        <img src="https://img.shields.io/npm/dm/endurance-js" alt="Downloads" />
      </a>
      <a href="https://github.com/capiloky/endurance-js/stargazers">
        <img src="https://img.shields.io/github/stars/capiloky/endurance-js" alt="Github Stars" />
      </a>
      <a href="https://www.npmjs.com/package/endurance-js">
        <img src="https://img.shields.io/github/v/release/capiloky/endurance-js?label=dev" alt="Github Stable Release" />
      </a>
   </p>
</p>

## Overview

Endurance.js is a Next.js API Resource library that allows you to create API resources for your Next.js application. It is built on top of Next.js API Routes and uses Prisma ORM to connect to your database.

## Getting Started

### Install Endurance JS

To get started, you can install Endurance.js using npm:

```bash npm2yarn2pnpm
npm install endurance-js
```

### Add API route

To add NextAuth.js to a project create a file called `[[...path]].ts` in `pages/api`. This contains the dynamic route handler for Endurance.js which will also contain all of your global Endurance.js configurations.

```typescript title="pages/api/[[...path]].ts" showLineNumbers
import serverHandler from "endurance-js/lib/router";
import { NextApiRequest, NextApiResponse } from "next";
import entities from "../../Entity";

export default function handler(req: NextApiRequest, res: NextApiResponse) {
    return serverHandler(req, res, {
        entities: entities,
    });
}
```

All requests to `/api/*` (`users`, `posts`, `roles`, etc.) will automatically be handled by Endurance.js.

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