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

localbased

v1.3.6

Published

Localbased is an intuitive no-code tool designed to assist developers, particularly frontend engineers, in quickly setting up a REST API for communicating with databases on their local machines. It aims to simplify the process of creating a backend server

Downloads

52

Readme

localbased

Localbased is an intuitive no-code tool designed to assist developers, particularly frontend engineers, in quickly setting up a REST API for communicating with databases on their local machines. It aims to simplify the process of creating a backend server and accessing dynamic data, enabling frontend developers to create full-stack side projects without the need to worry about building a REST API or handling database interactions.

Installation

npm i -g localbased

Initialization

In your current working directory run localbased start --port [port] this command starts the server on the specified port else the server runs on a default port of 2048.

E.g

localbased start --port 4000 this command starts the server on the specified port 4000

localbased start this command starts the server on the default port 2048

Endpoints

1. Create

  • Description: Creates a record in the database.

  • Endpoint: /:collectionName/create

  • Method: POST

  • Request Body:

    {
      ...data
    }
  • Sample Request: POST /users/create

    {
      "name": "owoade anuoluwapo",
      "email": "[email protected]",
      "password": "manager"
    }
  • Sample Response

    {
        "status": "success",
        "response": {
            "collectionName": "users",
            "data": {
                "_id": "51130271-1839-492b-b50b-1cca2ff19aa2",
                "name": "owoade anuoluwapo",
                "email": "[email protected]",
                "password": "manager",
                "timestamps": {
                    "createdAt": "2024-01-15T00:22:49.430Z",
                    "updatedAt": "2024-01-15T00:22:49.430Z"
                }
            }
        }
    }

2. Get All

  • Description: Retrieves all records in a collection.
  • Endpoint: /:collectionName/get/all
  • Method: GET
  • Query parameters:

| Parameter | Type | Description | |---------------------|----------|------------------------------------------------------------------------------------------------------| | page | number | This enables pagination of data, facilitating the retrieval of specific subsets for more efficient handling of large datasets. The default value is 1. | | limit | number | This refers to the amount of to be returned per request. The default value is 50. | | order | string | This is the order in which the result will be returned and can either be of value a which denotes ascending order or d descending order. The default value is a |

  • Sample Request: GET /users/get/all?order=a&limit=3&page=1

  • Sample Response

    {
    "status": "success",
    "response": {
        "collectionName": "users",
        "count": 359,
        "data": [
            {
                "_id": "cb405221-2266-4d87-9939-ded1fbd3eab7",
                "username": "Mary",
                "password": "kemi",
                "timestamps": {
                    "createdAt": 1705267312054
                }
            },
            {
                "_id": "a4bd932a-1f8e-4ff8-84c5-95e800326e1c",
                "username": "Mary",
                "password": "kemi",
                "timestamps": {
                    "createdAt": 1705267325168
                }
            }
        ]
    }
    }

3. Get one

  • Description: Gets one record from the database.
  • Endpoint: /:collectionName/get/single/:id
  • Method: GET
  • Route parameters:

| Parameter | Type | Description | |---------------------|----------|------------------------------------------------------------------------------------------------------| | id | string | This is the of the record to be fetched. |

  • Sample Request: GET /user/get/single/cc6443a8-7633-45d4-b6a1-4335c3c59f81

  • Sample Response

     {
      "status": "success",
      "response": {
          "collectionName": "users",
          "data": {
              "_id": "cc6443a8-7633-45d4-b6a1-4335c3c59f81",
              "name": "owoade anuoluwapo",
              "password": "manager",
              "timestamps": {
                  "createdAt": "2024-01-14T22:55:53.010Z",
                  "updatedAt": "2024-01-14T23:16:22.222Z"
              },
              "is_admin": true
          }
      }
    }

4. Update

  • Description: Updates a record in the database.

  • Endpoint: /:collectionName/update/:id

  • Method: PATCH

  • Request Body:

    {
      "update": {
        ...updates
      }
    }
  • Sample Request: PATCH /user/update/cc6443a8-7633-45d4-b6a1-4335c3c59f81

    {
      "update": {
       "is_admin": true
      }
    }
  • Sample Response

     {
      "status": "success",
      "response": {
          "collectionName": "users",
          "data": {
              "_id": "cc6443a8-7633-45d4-b6a1-4335c3c59f81",
              "name": "owoade anuoluwapo",
              "password": "manager",
              "timestamps": {
                  "createdAt": "2024-01-14T22:55:53.010Z",
                  "updatedAt": "2024-01-14T23:16:22.222Z"
              },
              "is_admin": true
          }
      }
    }

5. Delete

  • Description: Deletes a record from the database.

  • Endpoint: /:collectionName/delete/:id

  • Method: DELETE

  • Sample Request: DELETE /user/delete/cc6443a8-7633-45d4-b6a1-4335c3c59f81

    {
      "update": {
       "is_admin": true
      }
    }
  • Sample Response

    {
      "status": "success",
      "response": {}
    }

Error Response

An error response can be returned for a number of reasons, below is an example of an error response that can be returned. Note that all error response structure are the same.

{
  "status": "error",
  "response": false,
  "reason": "Document not found"
}

...Start Building 🚀🚀

Created with 🧡 by Owoade