Vérifiez si Postgres est installé sur votre ordinateur :
psql --version
Sinon, installez Postgres.
Lancez la console Postgres en tant que l'utilisateur postgres :
{ | |
"articles": [ | |
{ | |
"id": "3B8A9F8D-8E8D-43D6-BCB8-E136D3AD279D", | |
"title": "A journey through internet garbage" | |
}, | |
{ | |
"id": "85D4407D-496C-43BD-9B4D-93B6064B76EA", | |
"title": "The Cost of Fixing Things" | |
}, |
const parseDate = (year, fullDate) => { | |
if (!year) { | |
throw new Error('arg year is missing'); | |
} | |
if (!fullDate) { | |
return new Date(year); | |
} | |
return new Date(fullDate); | |
}; | |
module.exports = parseDate; |
Vérifiez si Postgres est installé sur votre ordinateur :
psql --version
Sinon, installez Postgres.
Lancez la console Postgres en tant que l'utilisateur postgres :
Used to make https://vimeo.com/610805063
Original images: https://unsplash.com/s/photos/ground%2Bsoil?orientation=landscape
const allImageUrls = new Set()
// run this after each time you scroll
convert *.jpg -resize 50% -set filename:f '%t' smaller/'%[filename:f].jpg' |
const { readFileSync, writeFileSync } = require("fs"); | |
function getFormattedTime(timeMilliseconds) { | |
return new Date(timeMilliseconds).toISOString().substring(11, 23); | |
} | |
const REPLACEMENT_PROBABILITY = 0.01; | |
const REPLACEMENT_CHARACTERS = "✴⦧⦖"; | |
function getRandomlyReplacedText(text) { | |
if (REPLACEMENT_PROBABILITY === 0) { |
const { performance } = require("perf_hooks"); | |
const start1 = performance.now(); | |
JSON.stringify({ emailAddress: "[email protected]" }); | |
const end1 = performance.now(); | |
console.log( | |
`Time taken to execute JSON.stringify function is ${end1 - start1}ms.` | |
); | |
const start2 = performance.now(); |
Before deploying your app, make sure it is ready for production (cheatsheet here).
With example commands for Ubuntu:
ssh ubuntu@<hostname>
With examples for Node.js services managed with Docker Compose:
npm run build
followed by npm run start
instead of npm run dev
)NODE_ENV=production
)docker-compose.prod.yml
, use expose
for internal services and ports
only for the gateway)GATEWAY_PORT=8000
)docker compose -f docker-compose.prod.yml up --build --detach
)restart: always
so that Docker will restart them automatically (after a reboot