Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
Initially using the airtable.js package we statically generated a splash page that pulls data from Airtable directly to the page.
git clone -b post3-starter https://github.com/gaurangrshah/next-airtable-splash.git
// /lib/pg-pool.js const { Pool } = require("pg"); // @link: https://node-postgres.com/guides/project-structure // @link: https://node-postgres.com/guides/async-express const pool = new Pool({ // configure database (* optional) host: process.env.DB_HOST, port: process.env.DB_PORT, user: process.env.DB_USER, password: process.env.DB_PW, database: process.env.DB_NAME, }); // retains count for number of connections established let count = 0; // used to log each pool connection pool.on("connect", (client) => { client.count = count++; console.log(`clients connected: ${count}`); }); // export an async query, which takes in necc. args. module.exports = { // query from pooled connection async query(text, params) { const start = Date.now(); // get starting time // connect to pool const client = await pool.connect(); const res = await client.query(text, params); client.release(); const duration = Date.now() - start; // get elapsed time // log results console.log("executed query", { /* text, params, */ duration, rows: res.rowCount, }); return res; // return results }, };
Node.js 10.13 or later