Skip to content

Files

Latest commit

bfe9b7c · Jan 3, 2025

History

History
93 lines (65 loc) · 3.15 KB

README.md

File metadata and controls

93 lines (65 loc) · 3.15 KB

Evora backend

GitHub contributors GitHub top language GitHub repo size GitHub License Quality Gate Status

Evora connects customers with event organizers quickly through detailed online booking.

Configuration

Create a .env file there and add the following environment variables:

# Variable Name Description Example
1 DATABASE_URL The URL to the MongoDB database localhost:27017/evora
2 JWT_SECRET The secret key for JWT secret-key
3 JWT_EXPIRES The expiration time for JWT 1h
4 GOOGLE_OAUTH2_CLIENT_ID The Google client ID abcxyz
5 GOOGLE_OAUTH2_CLIENT_SECRET The Google client secret secret-key
6 GOOGLE_OAUTH2_CLIENT_CALLBACK The Google client callback URL http://localhost:3000/api/auth/user/callback
7 ALLOWED_ORIGINS The allowed origins for CORS (separated by commas ) http://localhost:3000,https://localhost:3001
8 FRONTEND_URL The URL to the frontend http://localhost:5173

Development

  • Step 1: Install dependencies

    pnpm i
  • Step 2: Start the development server

    pnpm start:dev
  • Step 3: Open the browser and navigate to http://localhost:3000

Build & push container to Docker Hub

  • Setup Dockerfile

    # Example file:
    
    FROM node:lts-alpine
    WORKDIR /app
    COPY . .
    RUN yarn install --production
    CMD ["node", "src/index.js"]
    EXPOSE 3000
  • Build image Docker

    docker build -t your-dockerhub-username/image-name:[tag] .
  • Push image to Docker Hub

    docker push your-dockerhub-username/image-name:[tag]
  • Run docker container

    docker run -p 3000:3000 --env-file .env your-dockerhub-username/image-name:[tag]

Pull & run container

  • Pull image từ Docker Hub:

    docker pull your-dockerhub-username/image-name:[tag]
  • Chạy container:

    docker run -d -p 3000:3000 --name evora-backend your-dockerhub-username/image-name:[tag]
  • Kiểm tra container đang chạy:

    docker ps