Base URL: https://blog-505j.onrender.com/
- User authentication with JWT tokens
- Full CRUD operations for blog posts
- Comment system
- Like/unlike functionality
- PostgreSQL database integration
- Secure password hashing
- Token-based authorization
curl -X POST https://blog-505j.onrender.com/users/ \
-H "Content-Type: application/json" \
-d '{
"email": "your.email@example.com",
"password": "your_password"
}'curl -X POST https://blog-505j.onrender.com/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=your.email@example.com&password=your_password"After login, store the token for use in subsequent requests:
export TOKEN="your_access_token_here"curl -X POST https://blog-505j.onrender.com/blogs/ \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "My First Blog Post",
"content": "This is the content of my first blog post."
}'curl -X GET https://blog-505j.onrender.com/blogs/curl -X GET https://blog-505j.onrender.com/blogs/1curl -X PUT https://blog-505j.onrender.com/blogs/1 \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Blog Post Title",
"content": "This is the updated content of my blog post."
}'curl -X DELETE https://blog-505j.onrender.com/blogs/1 \
-H "Authorization: Bearer $TOKEN"curl -X POST https://blog-505j.onrender.com/blogs/1/comments/ \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"content": "This is a great post! Thanks for sharing."
}'curl -X PUT https://blog-505j.onrender.com/blogs/1/like \
-H "Authorization: Bearer $TOKEN"- Clone the repository
git clone https://github.com/satuiro/blog
cd blog- Create a virtual environment
python -m venv venv
source venv/bin/activate- Install dependencies
pip install -r requirements.txt- Set up environment variables
Create a
.envfile in the root directory:
DATABASE_URL=your_postgresql_connection_string
SECRET_KEY=your_secret_key
- Initialize the database
python create_tables.py- Run the development server
uvicorn main:app --reload