npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

endrun

v0.0.2

Published

Endrun is a simple and powerful web API framework that dynamically generates endpoints and Swagger documentation based on database models using Prisma ORM.

Downloads

5

Readme

GitHub Workflow Status GitHub Bundle Size Bundle Size Bundle Size npm type definitions GitHub last commit

Endrun

Endrun is a simple and powerful web API framework that dynamically generates endpoints and Swagger documentation based on database models using Prisma ORM.

Features

  • Dynamic Endpoint Generation: Automatically create endpoints for CRUD operations (GET, POST, PUT, DELETE) for each database model defined in Prisma, without the need for manual code writing.

  • Automatic Swagger Documentation: Generate Swagger documentation automatically for your APIs, specifying the operations available in each endpoint and the parameters required.

  • Prisma ORM Compatibility: Endrun works seamlessly with Prisma ORM for database management, providing a modern and efficient way to interact with your data.

  • Simplicity and Ease of Use: With its simple and user-friendly design, Endrun allows developers to quickly and confidently create powerful and stable APIs, without the need for repetitive code or unnecessary complexities.

Usage

To get started with Endrun, follow these simple steps:

  1. Install Endrun using npm:

npm install endrun dotenv prisma

vbnet Copy code

  1. Define your database models using Prisma.

  2. Import Endrun into your project and configure your endpoints.

  3. Start your server and enjoy the power and simplicity of Endrun!

Example

Here's a simple example of how to use Endrun to create an API endpoint:

// index.ts

import {Endrun} from 'endrun';
import dotenv from 'dotenv';

dotenv.config();

const PORT = process.env.PORT || 3030;

new Endrun().startServer(PORT);

and add the database address in the .env file :

# .env

DATABASE_URL=postgres://postgres:postgres@localhost:5432/endrun

you can add custom routes to Endrun class :

new Endrun((router, db) => [
  // base url /api
  // If /products exists, it overrides it; otherwise, it creates a new endpoint.
  router.get("/products", async (req, res) => {
    const result = await db.product.findMany();
    res.json(result);
  }),
  router.post("/products", async (req, res) => {
    const result = await db.product.create({
      data: await req.body, // An error is returned because we added that path to the withoutBodyParser !
    });
    res.json(result);
  }),
],{
  searchableModels : ["Product"],
  withoutBodyParser: ["/products"]
}).startServer(PORT);