database-gateway

App connects to a remote database

MIT License

Stars
2

Database Gateway

This system is designed to solve the problem of being unable to connect to an external database through VPN or other methods (where the database is not open to the public). It utilizes the TCP protocol to access the database connected to the client-side program that we have developed (the client program). The basic concept is that the user sends a SQL command request through the API, and then the server controls the client-side program connected to the database to execute the SQL command and return the results.

  • VPN ( Public) TCP protocal ( Client) Request SQL API Server Client SQL *

Installation

git clone https://github.com/Anechasun/database-gateway.git
cd database-gateway

npm install

Server

npm run start-server

Client

npm start

Create installable app file

npm run build

Usage

1. Start Server.

2. Start Client app.

3. Set up database in Client app.

Driver: Database types (postgresql, mysql, microsoft-sql-server)

Host: Database server.

Port: Database port.

Username: Username used to establish the connection.

Password: Password used to establish the connection.

Database: Database name.

Code: Client unique id.

4. Retrieve data in the database.

This is just a demo API. You can customize it as needed, as shown in this example code server/index.js.

curl -X GET \
  'http://localhost:3000/query?sql=SELECT * FROM users'
Related Projects