Skip to content

hyogshin/homiedummy-server

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

175 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Community Project Backend πŸš€

This repository contains the backend codebase for the Community Project, handling business logic, database operations, and API endpoints. It is built with Node.js and MariaDB.


Key Features ✨

  • πŸ“ RESTful APIs for CRUD operations on posts and comments
  • πŸ”’ User authentication and session management
  • πŸ“€ Profile management with image uploads
  • βš™οΈ Transaction handling for data consistency
  • πŸ” Secure password hashing and data validation

Tech Stack πŸ› οΈ

  • Node.js Node.js – Server-side runtime
  • Express Express – Web framework
  • MariaDB MariaDB – Database
  • bcrypt bcrypt – Password hashing
  • Multer Multer – File uploads

Installation πŸ–₯️

  1. Clone the repository:

    git clone https://github.com/100-hours-a-week/2-hayden-shin-community-be.git
    cd backend
  2. Install dependencies:

    npm install
  3. Create a .env file in the root directory:

    DB_HOST=localhost
    DB_USER=root
    DB_PASSWORD=yourpassword
    DB_DATABASE=community
    SESSION_SECRET=yoursecret
    
  4. Start the server:

    npm start

Project Structure πŸ“‚

β”œβ”€β”€ controller/
β”‚   β”œβ”€β”€ post.js
β”‚   β”œβ”€β”€ comment.js
β”‚   β”œβ”€β”€ auth.js
β”œβ”€β”€ model/
β”‚   β”œβ”€β”€ post.js
β”‚   β”œβ”€β”€ comment.js
β”‚   β”œβ”€β”€ auth.js
β”œβ”€β”€ router/
β”‚   β”œβ”€β”€ post.js
β”‚   β”œβ”€β”€ comment.js
β”‚   β”œβ”€β”€ auth.js
β”œβ”€β”€ db/
β”‚   └── database.js

API Endpoints 🌐

Authentication πŸ”‘

  • POST /auth/signup – Register a new user
  • POST /auth/login – Log in a user
  • POST /auth/logout – Log out the current user

Posts πŸ“

  • GET /posts – Retrieve all posts
  • GET /posts/:post_id – Retrieve a specific post
  • POST /posts – Create a new post
  • PATCH /posts/:post_id – Update a post
  • DELETE /posts/:post_id – Delete a post

Comments πŸ’¬

  • GET /posts/:post_id/comments – Retrieve comments for a specific post
  • POST /posts/:post_id/comments – Add a comment to a post
  • PATCH /comments/:comment_id – Update a comment
  • DELETE /comments/:comment_id – Delete a comment

Database Schema πŸ—„οΈ

Users πŸ‘€

  • id, username, email, password, profileImage, createdAt

Posts πŸ“

  • id, title, content, image, userId, likeCount, viewCount, commentCount, createdAt, updatedAt

Comments πŸ’¬

  • id, postId, content, userId, createdAt, updatedAt

Likes ❀️

  • id, postId, userId, createdAt

Contribution Guidelines 🀝

  1. Fork the repository

  2. Create a new branch

    git checkout -b feature-name
  3. Commit your changes

    git commit -m "feat: add feature"
  4. Push your branch

    git push origin feature-name
  5. Open a pull request

About

πŸ§‘β€πŸ’» The backend API for the HomieDummy community app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 99.5%
  • Dockerfile 0.5%