initial commit
This commit is contained in:
		
						commit
						07026dfc37
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | ||||
| venv/ | ||||
| 
 | ||||
							
								
								
									
										18
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | ||||
| # Use an official Python image as the base | ||||
| FROM python:3.10 | ||||
| 
 | ||||
| # Set the working directory | ||||
| WORKDIR /app | ||||
| 
 | ||||
| # Copy the application files | ||||
| COPY server.py /app/ | ||||
| COPY requirements.txt /app/ | ||||
| 
 | ||||
| # Install dependencies | ||||
| RUN pip install --no-cache-dir -r requirements.txt | ||||
| 
 | ||||
| # Expose the application port | ||||
| EXPOSE 8000 | ||||
| 
 | ||||
| # Run the FastAPI application using Uvicorn | ||||
| CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8000"] | ||||
							
								
								
									
										2
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | ||||
| fastapi | ||||
| uvicorn | ||||
							
								
								
									
										19
									
								
								server.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								server.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| from fastapi import FastAPI, Request | ||||
| import uvicorn | ||||
| 
 | ||||
| app = FastAPI() | ||||
| 
 | ||||
| 
 | ||||
| @app.get("/") | ||||
| def read_root(): | ||||
|     return {"message": "Server is running!"} | ||||
| 
 | ||||
| 
 | ||||
| @app.post("/") | ||||
| async def receive_data(request: Request): | ||||
|     data = await request.json() | ||||
|     print(data) | ||||
|     return {"received_data": data} | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     uvicorn.run(app, host="0.0.0.0", port=8000) | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ludwig Lehnert
						Ludwig Lehnert