Skip to content

osstsj/encuestas-backend

 
 

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

API for survey project using Nest and TypeScript.

Docker

Install Docker

1.- Enviroment variables

change variables in .env file

For Development change stage variable to dev

#Port for example 3001
PORT=

#Cors Domain for example http://localhost:3000
CORS_DOMAIN=

#Google Auth 2.0
#https://console.cloud.google.com
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

#encuesta-mongodb is a name of mongodb container, change only for production
#(use external mongodb service in production, Mongo Atlas for example)
#https://www.mongodb.com/atlas/database
MONGO_URI='mongodb://encuesta-mongodb:27017/surveydb'

2.- Build docker image

Build Project for Docker (MongoDB and Project in docker)

2.1 Production

Replace docker-compose.yml content for this and then execute the commands from step 2.2

version: '3.8'

services:

  backend:
    build:
      context: .
      target: prod
      dockerfile: Dockerfile
    container_name: encuesta-api
    image: encuesta-api
    ports:
      - ${PORT}:${PORT}
    env_file:
      - ./.env

2.2 Commands

Build image

docker compose -f docker-compose.yml build

Run Image

  • this command can be used for build and run docker image
docker compose -f docker-compose.yml up -d

Stay in touch

License

Nest is MIT licensed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 95.6%
  • JavaScript 2.6%
  • Dockerfile 1.8%