function getDateLastDayOfMonth(date) {
if (!date) return;
const [year, month] = date.split('-');
const lastDay = new Date(year, month, 0).getDate();
// JavaScript months are 0-indexed
return new Date(Date.UTC(year, month - 1, lastDay, 12));
}
docker run -e MYSQL_ROOT_PASSWORD=password -d -p 3306:3306 mysql
name: Deploy | |
on: | |
push: | |
branches: [main] | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
TF_STATE_BUCKET_NAME: ${{ secrets.AWS_TF_STATE_BUCKET_NAME }} | |
PRIVATE_SSH_KEY: ${{ secrets.AWS_SSH_KEY_PRIVATE }} |
{ | |
"name": "tst", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"prebuild": "rimraf dist", | |
"build": "tsc", | |
"start": "node ./dist/index.js", | |
"dev": "npm run prebuild && tsc-watch --onSuccess \"npm run start\"" |
ref. https://gist.github.com/silverark/2fd88d03fddbe373fce87da80afdc3ce
Line 22:
This connection string should be global, and reusable for all the operations, and not recreated for every method
Line 22:
It’s a really bad code practice to put the connection string inside the code, the common usage is to declare the variables inside a .env file for different environments, but never inside the code itself,
The variables, user, password and dbname should not be public.
const name = 'Sóstenes Apollo'; | |
const filterText = removeAccents(`%${name}%`).toLowerCase(); | |
console.log('Filter text', filterText); | |
this.prisma.$queryRaw`select | |
id, name | |
from users | |
where LOWER(unaccent(name)) LIKE ${filterText};`.then((users) => | |
console.log(users), | |
); |
-
Followed these steps: CONHEÇA O DOKKU & APRENDA A CONFIGURÁ-LO PASSO-A-PASSO
-
Crie um droplet na digital ocean usando vps com imagem do dokku
-
Crie um app no dokku via ssh do seu server
-
Lembrando que pra configurar o ssl o seu domínio tem que estar apontado para os servers da digital ocean