endurance-js
TypeScript icon, indicating that this package has built-in type declarations

0.0.21 • Public • Published

Endurance.js

Api Resources for Next.js

Open Source. Full Stack. Own Your Data.

Bundle Size Downloads Github Stars Github Stable Release

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:

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.

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.

Readme

Keywords

Package Sidebar

Install

npm i endurance-js

Weekly Downloads

7

Version

0.0.21

License

ISC

Unpacked Size

42.6 kB

Total Files

32

Last publish

Collaborators

  • capiloky