Download node/app.js from shreevardhan97/Speech-Synthesis-Data-Crowdsource: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/shreevardhan97/Speech-Synthesis-Data-Crowdsource/resolve/main/node/app.js
- Command line
-
hf download hf://spaces/shreevardhan97/Speech-Synthesis-Data-Crowdsource/node/app.js
-
curl -L -o app.js https://huggingface.co/spaces/shreevardhan97/Speech-Synthesis-Data-Crowdsource/resolve/main/node/app.js
1.02 kB
| const { Client } = require("pg"); | |
| (async () => { | |
| const client = new Client({ | |
| connectionString: process.env.DATABASE_URL, | |
| application_name: "$ docs_quickstart_node" | |
| }); | |
| const statements = [ | |
| // Clear any existing data | |
| "DROP TABLE IF EXISTS messages", | |
| // CREATE the messages table | |
| "CREATE TABLE IF NOT EXISTS messages (id UUID PRIMARY KEY DEFAULT gen_random_uuid(), message STRING)", | |
| // INSERT a row into the messages table | |
| "INSERT INTO messages (message) VALUES ('Hello world!')", | |
| // SELECT a row from the messages table | |
| "SELECT message FROM messages", | |
| ]; | |
| try { | |
| // Connect to CockroachDB | |
| await client.connect(); | |
| for (let n = 0; n < statements.length; n++) { | |
| let result = await client.query(statements[n]); | |
| if (result.rows[0]) { console.log(result.rows[0].message); } | |
| } | |
| await client.end(); | |
| } catch (err) { | |
| console.log(`error connecting: ${err}`); | |
| } | |
| // Exit program | |
| process.exit(); | |
| })().catch((err) => console.log(err.stack)); | |