v.0.11.3 api-server public port 8000
This commit is contained in:
@@ -7,8 +7,9 @@
|
||||
"dockerfile": "Dockerfile"
|
||||
},
|
||||
"runArgs": [
|
||||
"--network=dev-network",
|
||||
"--name=api-server"
|
||||
// "--network=dev-network",
|
||||
"--name=api-server",
|
||||
"-p", "8000:8000"
|
||||
],
|
||||
// "image": "mcr.microsoft.com/devcontainers/python:1-3.12",
|
||||
// "image": "python:latest",
|
||||
@@ -31,11 +32,11 @@
|
||||
}
|
||||
},
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [9000],
|
||||
"forwardPorts": [8000],
|
||||
// Use 'portsAttributes' to set default properties for specific forwarded ports.
|
||||
// More info: https://containers.dev/implementors/json_reference/#port-attributes
|
||||
"portsAttributes": {
|
||||
"9000": {
|
||||
"8000": {
|
||||
"label": "API-Server Application",
|
||||
"onAutoForward": "notify"
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ from app.models import Item, dummy_items
|
||||
app = FastAPI(title="FastAPI Server", version="1.0.0")
|
||||
|
||||
# CORS middleware to allow client requests
|
||||
# app.add_middleware(
|
||||
# CORSMiddleware,
|
||||
# # allow_origins=["http://localhost:3000", "http://client:3000"],
|
||||
# allow_credentials=True,
|
||||
# allow_methods=["*"],
|
||||
# allow_headers=["*"],
|
||||
# )
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
# allow_origins=["http://localhost:3000", "http://client:3000"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
|
||||
Reference in New Issue
Block a user