A simple notes service which stores notes and sends an hourly digest email of the latest notes.
This is forked from the Express Hello world example on Render.
Deployed at https://simple-notes-server.onrender.com/notes
Signup for a free mailjet account
Create a new PostgreSQL 13 DB
Create a new web service with the following values:
- Build Command:
yarn - Start Command:
node app.js - Environment Variables:
CONNECTION_STRING: Internal connection string from your DB
Create a new cron job with the following values:
- Environment: Docker
- Region: Oregon, USA
- Schedule:
* 0 0 0 0(every hour) - Environment Variables:
DB_NAME,DB_USER,PGPASSWORD: DB name, username, and password - can all be found on DB info pageMAILJET_APIKEY,MAILJET_SECRET: Mailjet API and secret keys - can be found here if you're logged inMY_EMAIL,MY_NAME: The email you registered with your Mailjet account, and your name
In node REPL:
const { Pool } = require('pg');
const pool = new Pool({connectionString: '<DB External Connection String>?ssl=true'});
pool.query('CREATE TABLE notes (text text, created timestamp);', console.log);Unix (curl):
curl -X POST <Your web service URL>/notes -H 'Content-Type: application/json' -d '{"note": "<note text>"}'
Windows (powershell/Invoke-WebRequest):
Invoke-WebRequest -Uri <Your web service URL>/notes -Method POST -ContentType application/json -Body '{"note": "<note text>"}'