Download Amazon-Clone-PERN-stack/server/database/pool.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 310 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Amazon-Clone-PERN-stack/server/database/pool.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Amazon-Clone-PERN-stack/server/database/pool.js
-
curl -L -o pool.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Amazon-Clone-PERN-stack/server/database/pool.js
310 Bytes
| const { Pool } = require("pg"); | |
| class PoolClass { | |
| _pool = null; | |
| connect(option) { | |
| this._pool = new Pool(option); | |
| return this._pool.query("SELECT 1+1 ;"); | |
| } | |
| query(sql, values) { | |
| return this._pool.query(sql, values); | |
| } | |
| close() { | |
| return this._pool.end(); | |
| } | |
| } | |
| module.exports = new PoolClass(); | |