Skip to content

batuhanbaybas/blog-api

Repository files navigation

Blog API with Express.js, TypeScript, and Docker

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.

Features

  • CRUD operations for blog posts and auth system
  • Postgres as the database
  • Express.js for routing
  • TypeScript for static typing
  • Docker for containerization

Prerequisites

Make sure you have the following tools installed before running the project:

  • Node.js
  • npm (Node Package Manager)
  • Docker
  • Docker Compose

Installation and Setup Instructions

  1. Clone the repository
git clone https://github.com/batuhanbaybas/blog-api.git
  1. Go directory
cd blog-api
  1. Install dependencies
npm install
  1. Create a .env file and add the following environment variables
cp .env.global .env
  1. Start the Docker containers
docker-compose up -d
  1. Generate and Migrate the database tables
prisma generate && prisma migrate dev 
  1. Run the project
npm start

API Endpoints

Auth

Method Endpoint Description
POST /api/auth/register Register a new user
POST /api/auth/login Login a user

Posts

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published