Skip to content

Commit bf1d310

Browse files
authored
Merge pull request #35 from dacharyc/final-cleanup-pass
Final cleanup pass
2 parents 2f9ea16 + 91a134a commit bf1d310

File tree

12 files changed

+122
-278
lines changed

12 files changed

+122
-278
lines changed

mflix/README-JAVASCRIPT-EXPRESS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This is a full-stack movie browsing application built with Express.js and Next.j
1818

1919
- **Node.js 22** or higher
2020
- **MongoDB Atlas cluster or local deployment** with the `sample_mflix` dataset loaded
21-
- [Load sample data](https://www.mongodb.com/docs/atlas/sample-data/)
21+
- [Load sample data](https://www.mongodb.com/docs/atlas/sample-data/)
2222
- **npm** (included with Node.js)
2323
- **Voyage AI API key** (For MongoDB Vector Search)
2424
- [Get a Voyage AI API key](https://www.voyageai.com/)
@@ -54,7 +54,6 @@ VOYAGE_API_KEY=your_voyage_api_key
5454
PORT=3001
5555
NODE_ENV=development
5656
57-
5857
# CORS Configuration
5958
# Allowed origin for cross-origin requests (frontend URL)
6059
# For multiple origins, separate with commas

mflix/README-PYTHON-FASTAPI.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This is a full-stack movie browsing application built with Python FastAPI and Ne
2222
- **Python 3.10** to **Python 3.13**
2323
- **Node.js 20** or higher
2424
- **MongoDB Atlas cluster or local deployment** with the `sample_mflix` dataset loaded
25-
- [Load sample data](https://www.mongodb.com/docs/atlas/sample-data/)
25+
- [Load sample data](https://www.mongodb.com/docs/atlas/sample-data/)
2626
- **pip** for Python package management
2727
- **Voyage AI API key** (For MongoDB Vector Search)
2828
- [Get a Voyage AI API key](https://www.voyageai.com/)
@@ -56,7 +56,7 @@ VOYAGE_API_KEY=your_voyage_api_key
5656
5757
# CORS Configuration
5858
# Comma-separated list of allowed origins for CORS
59-
CORS_ORIGINS=http://localhost:3000,http://localhost:8000
59+
CORS_ORIGINS=http://localhost:3000,http://localhost:3001
6060
```
6161

6262
**Note:** Replace `username`, `password`, and `cluster` with your actual MongoDB Atlas
@@ -69,7 +69,7 @@ python -m venv .venv
6969
```
7070

7171
Activate the virtual environment:
72-
72+
7373
```bash
7474
source .venv/bin/activate
7575
```
@@ -85,12 +85,13 @@ pip install -r requirements.txt
8585
From the `server/` directory, run:
8686

8787
```bash
88-
fastapi dev main.py --reload
88+
uvicorn main:app --reload --port 3001
8989
```
9090

91-
The server will start on `http://localhost:8000`. You can verify it's running by visiting:
92-
- API root: http://localhost:8000/api/movies
93-
- API documentation (Swagger UI): http://localhost:8000/docs
91+
The server will start on `http://localhost:3001`. You can verify it's running by visiting:
92+
- API root: http://localhost:3001/api/movies
93+
- API documentation (Swagger UI): http://localhost:3001/docs
94+
- Interactive API documentation (ReDoc): http://localhost:3001/redoc
9495

9596
### 3. Configure and Start the Frontend
9697

@@ -118,8 +119,8 @@ The Next.js application will start on `http://localhost:3000`.
118119

119120
Open your browser and navigate to:
120121
- **Frontend:** http://localhost:3000
121-
- **Backend API:** http://localhost:8000
122-
- **API Documentation:** http://localhost:8000/docs
122+
- **Backend API:** http://localhost:3001
123+
- **API Documentation:** http://localhost:3001/docs
123124

124125
## Features
125126

@@ -204,4 +205,3 @@ If you have problems running the sample app, please check the following:
204205
If you have verified the above and still have issues, please
205206
[open an issue](https://github.com/mongodb/docs-sample-apps/issues/new/choose)
206207
on the source repository `mongodb/docs-sample-apps`.
207-

mflix/client/.env.example

Lines changed: 0 additions & 6 deletions
This file was deleted.

mflix/client/README.md

Lines changed: 0 additions & 91 deletions
This file was deleted.

mflix/server/python-fastapi/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ VOYAGE_API_KEY=your_voyage_api_key
99

1010
# CORS Configuration
1111
# Comma-separated list of allowed origins for CORS
12-
CORS_ORIGINS="http://localhost:3000,http://localhost:8000"
12+
CORS_ORIGINS="http://localhost:3000,http://localhost:3001"

mflix/server/python-fastapi/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ async def lifespan(app: FastAPI):
1717
# Startup: Create search indexes
1818
await ensure_search_index()
1919
await vector_search_index()
20+
21+
# Print server information
22+
print(f"\n{'='*60}")
23+
print(f" Server started at http://127.0.0.1:3001")
24+
print(f" Documentation at http://127.0.0.1:3001/docs")
25+
print(f" Interactive API docs at http://127.0.0.1:3001/redoc")
26+
print(f"{'='*60}\n")
27+
2028
yield
2129
# Shutdown: Clean up resources if needed
2230
# Add any cleanup code here

mflix/server/python-fastapi/src/database/mongo_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
client = AsyncMongoClient(os.getenv("MONGO_URI"))
99
db = client[os.getenv("MONGO_DB")]
1010

11-
# Set the API key but don't instantiate the client here
1211
voyage_api_key = os.getenv("VOYAGE_API_KEY")
1312
if voyage_api_key:
1413
voyageai.api_key = voyage_api_key

mflix/server/python-fastapi/src/models/models.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,6 @@ class Movie(BaseModel):
3838
"populate_by_name" : True
3939
}
4040

41-
42-
'''
43-
So this an interesting conversion. Pydanic doesn't cleanly support constructing
44-
models that have MongoDB query operators as field names. This becomes an issue when
45-
we want to convert the validated model back to a dictionary to use as a MongoDB query filter.
46-
For example, if a user leaves the 'q' parameter blank, we don't want to include the '$text' operator
47-
in the filter at all but validation will send an empty value for it and that causes errors. So
48-
I am handling the validation in the query router itself, but leaving this here as an example of how
49-
it could be done, if I am wrong about Pydantic's capabilities.
50-
'''
51-
5241
class TextFilter(BaseModel):
5342
search: str = Field(..., alias="$search")
5443

0 commit comments

Comments
 (0)