This repo is an example of Bridg being used in a serverless capacity, with a static client via create-react-app, and a single Netlify cloud function for handling requests from Bridg.
Note: This could be used with any cloud function provider, it doesn't necessarily need to be Netlify.
We just need a single function that can handle Bridg requests and to communicate with our database.
Set up project with Netlify:
- Fork this project
npm install -g netlify-cli
netlify init
Configure your database connection:
- Set up a cloud DB (you can get a free Postgres DB at https://www.elephantsql.com/)
- create a file named
.env
at the root of the project - Add your DB url:
DATABASE_URL="postgres://username:pass@host:port/dbname"
Startup
npm install
npm run dev
To deploy your project to Netlify, just git push