-
-
Notifications
You must be signed in to change notification settings - Fork 715
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix pg and mysql proxy examples
- Loading branch information
1 parent
d1d16d9
commit 968ee62
Showing
6 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
import * as mysql from 'mysql2/promise'; | ||
import express from 'express'; | ||
import RateLimit from 'express-rate-limit'; | ||
|
||
const app = express(); | ||
|
||
const limiter = RateLimit({ | ||
windowMs: 15 * 60 * 1000, // 15 minutes | ||
max: 100, // max 100 requests per windowMs | ||
}); | ||
|
||
app.use(express.json()); | ||
app.use(limiter); | ||
const port = 3000; | ||
|
||
const main = async () => { | ||
const connection = await mysql.createConnection('mysql://root:[email protected]:5432/drizzle'); | ||
|
||
app.post('/query', async (req, res) => { | ||
const { sql: sqlBody, params, method } = req.body; | ||
const { sql, params, method } = req.body; | ||
|
||
// prevent multiple queries | ||
const sqlBody = sql.replace(/;/g, ''); | ||
|
||
if (method === 'all') { | ||
try { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters