Skip to content

An example blog app built with ecewo and PostgreSQL

License

Notifications You must be signed in to change notification settings

savashn/ecewo-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ecewo Example Blog App

This is an example blog app built with Ecewo and PostgreSQL.

Warning

This is not a real-world app. It is built to show what Ecewo looks like.

Using dependencies:

Requirements

  • CMake version 3.14 or higher
  • libpq
  • libsodium (Not required on Windows, as it's already included in the vendors/libsodium-win64 folder)

Installation

1. Clone the repo:

git clone https://github.com/savashn/ecewo-example.git
cd ecewo-example

2. Configure .env

Before compiling the program, create a .env file in the project's root directory and define the following environment variables. Otherwise, you may encounter a segmentation fault at startup.

PORT
DB_HOST
DB_PORT
DB_NAME
DB_USER
DB_PASSWORD

3. Build and run the project

3.1 Build via Bash Script

You can build with the following command:

./build.sh

If you make some changes on the project and would lite to build from scratch:

./build.sh rebuild

3.2 Build Manually

If you prefer to build manually, run the suitable command:

Manually building on Windows:

mkdir build && cd build && cmake .. && cmake --build . && ./server.exe

Manually building on Linux/macOS:

mkdir build && cd build && cmake .. && cmake --build . && ./server

Endpoints

You can see all the endpoints in src/routers/routers.c file.

Here are what POST and PUT endpoints wait for:

POST /register

{
    "name": "John Doe",
    "username": "johndoe",
    "password": "123123",
    "email": "noone@nowhere.com",
    "about": "About John Doe"
}

POST /login

{
    "username": "johndoe",
    "password": "123123"
}

OR

{
    "email": "noone@nowhere.com",
    "password": "123123"
}

POST /create/category

{
    "category": "John Doe's Test Category"
}

POST /create/post

{
    "header": "John Doe's Example Post",
    "content": "John Doe's example post content",
    "categories": [1]
}

PUT /user/:user/categories/:category

{
    "category": "John Doe's Edited Test Category"
}

PUT /user/:user/posts/:post

{
    "header": "John Doe's Edited Example Post",
    "content": "John Doe's edited example post content",
    "categories": []
}

About

An example blog app built with ecewo and PostgreSQL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published