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 🙏

© 2026 – Pkg Stats / Ryan Hefner

lighrestapi

v0.5.0

Published

Light weight rest api for developers

Readme

lighrestapi

lighrestapi is simple and light weight REST API, uses json files to store the information.

Who needs lighrestapi

You are in need of simple API endpoints to support your web application without spending lot of time on API development.

lightrestpi provides APIs with zero configurations and free flow strategy, means no restrictions on table columns and data types, its simple json format stored in json files.

Installation

Install via npm

npm i lighrestapi

Usage

// index.js
const api = require('lighrestapi');

api.start({
    port: 1337, // port to start api
    projectPath: __dirname, // project root folder
    requestHeaders: ['x-api-key'] // configure allowed headers
});

To start the API server run below command in terminal/command prompt

node index.js

Thats it you should see below message in terminal

Server Listening on 1337

Now, you are good to utilize the API endpoints in REST CRUD format. Lets see the available endpoints quickly

Here you can create many tables as you want just use tablename query param to specify the table name.

Create record

Endpoint: http://localhost:1337/api/query?tablename=countries

example code using axios from Frontend to create the record in JSON

var data = JSON.stringify({"name":"India","code":"INR"});

var config = {
  method: 'post',
  url: 'http://localhost:1337/api/query?tablename=countries',
  headers: { 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

Read

Endpoint: http://localhost:1337/api/query?tablename=countries

example code using axios to fetch the list of records

var config = {
  method: 'get',
  url: 'http://localhost:1337/api/query?tablename=countries',
  headers: { }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

Update

Endpoint: http://localhost:1337/api/query?tablename=countries&id=eda612d3d48a83629580f5d8179315e53f8

example code using axios to update the specific record with respective to id attribute

var data = JSON.stringify({"age":"30"});

var config = {
  method: 'patch',
  url: 'http://localhost:1337/api/query?tablename=countries&id=eda612d3d48a83629580f5d8179315e53f8',
  headers: { 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

Delete

Endpoint: http://localhost:1337/api/query?tablename=countries&id=eda612d3d48a83629580f5d8179315e53f8

example code using axios to delete the record from the list

var config = {
  method: 'delete',
  url: 'http://localhost:1337/api/query?tablename=countries&id=eda612d3d48a83629580f5d8179315e53f8',
  headers: { }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

Usefull information

If you check the response of each endpoint is consistant and we are returning list of records available in the specified table.

{
    "data": [
        {
            "name": "India",
            "code": "INT",
            "id": "66de8f55cb55abff1e526fb117931727338"
        },
        {
            "name": "Canada",
            "code": "CAD",
            "id": "5ff92d8e7e5878eea1a059c51793172ce2d"
        }
    ]
}

Postman Collection: https://documenter.getpostman.com/view/3476064/TzRNDUqQ

Whats next

  • Ability to use MongoDB
  • Encryption on sensitive information/fields
  • Keeping it simple