The Blog Backend Drogon Project is a RESTful API that provides the backend for the Client App.
- Drogon Framework: Built on top of Drogon, leveraging its features for high speed.
- Simple Blogging: Create, edit, and delete blog posts.
- Authentication
- Fully Migrated DB link
- Validator and Error handling (Current handling is dog water)
- Nested comments
- Dockerize
BASE_URL : localhost:3000
/auth/**
- Authentication endpoints/me/**
- Users endpoints/posts/**
- Posts endpoints/Comments/**
- Comments endpoints/Categories/**
- Categories endpoints
For more details you can import Blog.postman_collection.json into Postman.
- C++2a
- Cmake 3.20.0
- Drogon 1.5.0
- PostgreSQL 16
I tested on OSx so Linux will probably work. Window I have no ideas, because I don't have window device, may god bless your soul.
-
Clone the repository:
git clone https://github.com/vodoanminhhieuvn/drogon_blog.git
-
Install dependencies:
- Please follow the instructions on Drogon to install Drogon.
- To add third-parties library, create library folder.
mkdir library
cd library
git clone https://github.com/Thalhammer/jwt-cpp.git
git clone https://github.com/openssl/openssl.git
git clone https://github.com/trusch/libbcrypt.git
cd ..
-
Build the project:
cd drogon-blog mkdir build cd build cmake .. make
-
Run the server:
./wblog
-
Open your Postman and navigate to
http://localhost:3000
to access the blog.
Run init.sql to create the database and table
By default, the project is configured to connect to PostgreSQL database. You need to update your own config.json and model.json file to connect to your own database.
You want to create a new model, you can use the following command:
drogon_ctl create model models