Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Latest commit

 

History

History

06_Data_Postgres_JS

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

postgresjs Function

Connects to a PostgreSQL instance and perform two operations:

  1. Insert a new row into the "invocations" table with an invocation ID
  2. Query the "invocations" table for all the invocation IDs

Local Development

  1. Export your Heroku Postgres configuration

Make sure you have the DATABASE_URL connection string in the .env file of this folder. For using this recipe on a Compute Environment please refer to the Heroku Data in Functions documentation.

heroku config -a <app_name> --shell > .env
  1. Install dependencies with
npm install
  1. Run tests with
npm test
  1. Start your function locally
sf run function start --verbose
  1. Invoke your function locally
sf run function --function-url=http://localhost:8080 --payload='{}'