Skip to content

Confucii/blog-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog API

This project is a comprehensive blogging system consisting of three main parts: a RESTful API, a client-side application, and a content management system (CMS) for administrators. It allows admins to create, read, update, and delete blog posts, submit comments, and manage blog content efficiently.

Client layout image

CMS layout image

Description

The Blog API is the backbone of the entire system, responsible for handling data related to users, posts, and comments. It is built using MongoDB as the database and Express.js as the server framework. The API employs the following key features:

Data Models:

There are three primary data models within the API - user, post, and comment. The comment model is linked to the post model through a reference to the post's unique identifier. This relationship allows comments to be associated with specific posts.

Data Validation:

Input data is validated using the express-validator library to ensure data integrity and security.

User Authentication:

Users that are logged in will receive a JWT token, allowing to maintain persistent access. Notably, only the Content Management System (CMS) allows users to login; client-side users cannot log in.

Authorization:

For protected routes, JWT token received with request cookies are verified to determine if user has access.

API Endpoints:

The API supports various endpoints for performing CRUD (Create, Read, Update, Delete) operations on posts and comments, including the ability to get, submit, update, and delete posts individually, and retrieve all posts. Users can also create, retrieve, and delete comments.

Technologies used

javascriptexpressnodeJS MongoDB

AI generated humor:
Q: Tell me a joke about backend authorization
A: Why did the backend authorization system go to therapy?
Because it had too many issues with trust and kept denying access to its feelings!

About

The Odin project API for blog

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published