Skip to content

Commit 8ff27f3

Browse files
committed
Added a README.
1 parent 67ab7e4 commit 8ff27f3

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# MongoDB with FastAPI
2+
3+
This is a small sample project demonstrating how to build an API with [MongoDB](https://developer.mongodb.com/) and [FastAPI](https://fastapi.tiangolo.com/).
4+
It was written to accompany a [blog post](https://developer.mongodb.com/quickstart/python-quickstart-fastapi/) - you should go read it!
5+
6+
## TL;DR
7+
8+
If you really don't want to read the [blog post](https://developer.mongodb.com/quickstart/python-quickstart-fastapi/) and want to get up and running,
9+
activate your Python virtualenv, and then run the following, to run the code run the following from your terminal (edit the `DB_URL` first!):
10+
11+
```bash
12+
# Install the requirements:
13+
pip install -r requirements.txt
14+
15+
# Configure the location of your MongoDB database:
16+
export DB_URL="mongodb+srv://<username>:<password>@<url>/<db>?retryWrites=true&w=majority"
17+
18+
# Start the service:
19+
uvicorn app:app --reload
20+
```
21+
22+
(Check out [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) if you need a MongoDB database.)
23+
24+
Now you can load http://localhost:8000 in your browser ... but there won't be much to see until you've inserted some data.
25+
26+
If you have any questions or suggestions, check out the [MongoDB Community Forums](https://developer.mongodb.com/community/forums/)!

0 commit comments

Comments
 (0)