otmjka / pplmap-backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npx express --git backend

git remote add origin https://github.com/otmjka/pplmap-backend.git https://gist.github.com/subfuzion/08c5d85437d5d4f00e58

===

git push https://otmjka@github.com/otmjka/pplmap-backend.git

===

curl -d '{"name":"dima", "birthday":495136800000}' -H "Content-Type: application/json" -X POST localhost:3001/persons/add --verbose

  1. deploy app to heroku

benefits wished

  • free for try
  • postgres service
  • automation, deploy by one command

steps:

  • build ts app to node version
  • try in docker
  • build app docker try run
  • how to set env variables

typescript

build js

npx tsc --noEmit false
ENVIRONMENT=local PORT=3001 POSTGRES_URI='postgres://postgres:postgres@127.0.0.1:5432/postgres' node build/index.js

docker

-heroku docker

ENV PORT=3001
ENV POSTGRES_URI=postgres://postgres:postgres@host.docker.internal:5432/postgres
ENV ENVIRONMENT=production
ENV LOG_LEVEL=debug

docker build -t pplmap-backend-000:latest .

// ENV POSTGRES_URI=postgres://postgres:postgres@host.docker.internal:5432/postgres
docker run --rm -it -e DATABASE_URL='host.docker.internal:5432' -e ENVIRONMENT=local -e PORT=3001 -e DB_NAME=postgres -e DB_PASSWORD=postgres -e DB_USER=postgres pplmap-backend-000:latest /bin/bash

docker get access to localhost postgres on mac

heroku

push to heroku

docker build -t pplmap-backend-000:latest .
heroku container:push web

Express cors

About


Languages

Language:TypeScript 93.5%Language:JavaScript 4.4%Language:Dockerfile 2.0%