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

sqlink

v1.1.7

Published

SQLink is a Node.js library that turns MySQL tables into RESTful APIs with procedure execution and full CRUD support.

Downloads

273

Readme

npm version license downloads

SQLink is a Node.js library that turns MySQL tables into RESTful APIs with procedure execution and full CRUD (Create, Read, Update, Delete) support. With SQLink, you can easily expose your MySQL tables and stored procedures as APIs, allowing seamless interaction with your database through HTTP requests.

Installation

Before using SQLink, ensure that you have npm installed on your machine. You can install SQLink globally using the following commands:

  • For Linux/MacOS:
    sudo npm install -g sqlink
  • For Windows:
    npm install -g sqlink

Getting Started

Before querying data from MySQL, you need to configure SQLink. To do this, run the following command:

sqlink run

After running this command, you will be prompted in the console to enter your MySQL credentials.

Important: Configuration is required only when you run the program for the first time or if the configuration file has been deleted.

Once you enter the MySQL and Server configuration, you can re-run sqlink run command again and start querying the data.

Usage

Querieing Tables

SQLink allows you to interact with your MySQL tables using RESTful endpoints.

Base URL:

https://localhost:3001/table/{tableName}/{mode}
  • tableName: The name of the MySQL table you want to query.
  • mode: The operation you want to perform. It can be one of the following: create, read, update, delete.

Create

Use this method to insert data into your MySQL table.

  • URL:
    https://localhost:3001/table/{tableName}/create
  • Method: POST
  • Payload:
    {
        "column1": "value1",
        "column2": "value2"
    }
  • Response:
    • 200 OK if inserted successfully.

Read

Use this method to retrieve data from your MySQL table.

  • URL:
    https://localhost:3001/table/{tableName}/read
  • Method: GET
  • Response:
    • 200 OK if queried successfully.

Update

Use this method to update data in your MySQL table.

  • URL:
    https://localhost:3001/table/{tableName}/update({updateKey},{updateValue})
  • Method: PUT
  • Payload:
    {
        "column1": "value1_updated",
        "column2": "value2_updated"
    }
  • Response:
    • 200 OK if updated successfully.

Delete

Use this method to delete a record from your MySQL table.

  • URL:
    https://localhost:3001/table/{tableName}/delete({deleteKey},{deleteValue})
  • Method: DELETE
  • Payload:
    {
       // Payload is not considered even if sent from the client
    }
  • Response:
    • 200 OK if deleted successfully.

Executing Procedures

SQLink also supports executing stored procedures through API calls.

Base URL:

https://localhost:3001/procedure/{procedureName}
  • Stored Procedures: A stored procedure in SQL is a precompiled collection of SQL statements stored in the database, which can be executed as a single unit to perform a specific task, like data manipulation or business logic.

Example

  • URL:
    https://localhost:3001/procedure/topfiveusers()
    Or with arguments:
    https://localhost:3001/procedure/topfiveusers('MALE')
  • Method: GET
  • Response:
    • 200 OK if executed successfully.

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss potential improvements or new features.

License

This project is licensed under the MIT License. See the LICENSE file for details.