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 Node script reproduces an issue where, when passing numbers to an | |
UPDATE SQL query in "pg", it complains that the values are of type | |
text. | |
There is an existing open issue at https://github.com/brianc/node-postgres/issues/2159 | |
which is similar but the query is different | |
*/ | |
const pg = require("pg"); | |
const pgConfig = { |
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
import fs from "fs"; | |
// You can use "formidable-serverless" if in a serverless environment like | |
// AWS Lamba or Google Cloud Functions | |
import formidable from "formidable"; | |
import sendgridMail from "@sendgrid/mail"; | |
import { AttachmentData } from "@sendgrid/helpers/classes/attachment"; | |
sendgridMail.setApiKey(process.env.SENDGRID_API_KEY); |
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
// Run in the browser | |
// This function takes "someId" as a parameter, as an example that you | |
// may want to link the video upload to some object in your database. | |
// This is of course totally optional. | |
function uploadVideo( | |
someId: number, | |
file: File, | |
listeners: { | |
onProgress: (perc: number) => void; |