Commit a69426dc authored by Ai-Sasit's avatar Ai-Sasit

update mongodb

parent cc9195c2
version: '3'
services:
web:
container_name: easybistro-api
build: .
ports:
- "80:80"
depends_on:
- mongodb
mongodb:
image: mongo:latest
container_name: database
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: easybistro
MONGO_INITDB_ROOT_PASSWORD: xejP3257
mongo-express:
image: mongo-express:latest
container_name: mongo-monitor
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: easybistro
ME_CONFIG_MONGODB_ADMINPASSWORD: xejP3257
ME_CONFIG_MONGODB_SERVER: database
depends_on:
- mongodb
import re
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.httpsredirect import HTTPSRedirectMiddleware
from server.routes.scb_service import scb
from server.routes.user import user
......@@ -17,7 +19,7 @@ origins = [
"https://easybistro-office.web.app",
"https://easybistro-owner-manager.web.app",
]
app.add_middleware(HTTPSRedirectMiddleware)
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
......
......@@ -2,7 +2,7 @@ import pymongo
def get_connection(collection:str):
client = pymongo.MongoClient('mongodb+srv://SasitAi:Tackle123@easybistro.7qdtgg2.mongodb.net/Easybistro')
client = pymongo.MongoClient('mongodb://easybistro:xejP3257@localhost:27017/Easybistro')
return client['easybistro'][collection]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment