This repository contains a simple blog API built using Express.js, TypeScript, and Docker. It serves as a basic template for creating a RESTful API for a blogging platform.
- CRUD operations for blog posts and auth system
- Postgres as the database
- Express.js for routing
- TypeScript for static typing
- Docker for containerization
Make sure you have the following tools installed before running the project:
- Node.js
- npm (Node Package Manager)
- Docker
- Docker Compose
- Clone the repository
git clone https://github.com/batuhanbaybas/blog-api.git- Go directory
cd blog-api- Install dependencies
npm install- Create a .env file and add the following environment variables
cp .env.global .env- Start the Docker containers
docker-compose up -d- Generate and Migrate the database tables
prisma generate && prisma migrate dev - Run the project
npm start| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register | Register a new user |
| POST | /api/auth/login | Login a user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/post/all | Get all posts |
| GET | /api/post/single/:id | Get a post by id |
| POST | /api/post/create | Create a new post |
| PUT | /api/post/update/:id | Update a post by id |
| DELETE | /api/post/delete/:id | Delete a post by id |