Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bloblblobl/simple-notes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

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

Deployment

Signup for a free mailjet account

On Render...

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 page
    • MAILJET_APIKEY, MAILJET_SECRET: Mailjet API and secret keys - can be found here if you're logged in
    • MY_EMAIL, MY_NAME: The email you registered with your Mailjet account, and your name

DB setup

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);

Create note

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>"}'

About

Express Hello World Example on Render https://render.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%