/boo_world

Boo Backend is a versatile application designed to facilitate the creation of user accounts, comments, and the ability to like or dislike comments with ease and efficiency. This robust platform provides a seamless user experience for managing interactions within the system.

Primary LanguageEJS

Welcome to Boo World Backend

About

Boo Backend is a versatile application designed to facilitate the creation of user accounts, comments, and the ability to like or dislike comments with ease and efficiency. This robust platform provides a seamless user experience for managing interactions within the system.

Features

  • Creating a new User Profile
  • You can do comments and likes, unlikes
  • Relationships Comments with profileID.
  • Error Handling.

Technologies Used

  • Node.js
  • MongoDB
  • Mocha (For unit testing)

Clone Repository

git clone https://github.com/Amanmandal-M/boo_world.git

Prerequisites

  • Javascript
  • NodeJS
  • MongoDB

Installation

cd boo_world
npm run start

Start the Backend server

npm run start
or
npm run server
or
node app.js

MVC Structure

├── app.js
├── configs
|    └── db.js
├── models
|    └── profileModel.js
|    └── commentModel.js
├── routes
|    └── profile.js
|    └── comment.js
├──controllers
|    └── profile.js
|    └── comment.js
|    └── HomePageController.js
├──views
|    ├──partials
|    |    └── categories.ejs
|    |    └── epilogue.ejs
|    |    └── footer.ejs
|    |    └── header.ejs
|    |    └── metadata.ejs
|    |    └── profile_card.ejs
|    |    └── prologue.ejs
|    |    └── scripts.ejs
|    |    └── styles.ejs
|    └──profile_template.ejs
├──helpers
|    └── successAndError.js
├──public
|    ├── static
|    |    └── space.png
|    |    └── wing.png
|    ├── sample.md

Note :

  • Before doing anything first create .env file and put PORT, NODE_ENV, MONGO_URI.
  • If you are not using MONGO_URI so don't worry it will run automatically using mongoDB-memory-server
  • PORT is for listening the server.
  • MONGO_URL is for running database and store your data in database so put your mongo link.
  • NODE_ENV is for accessing database for test and it is like a authentication but not full authentication .

Endpoints

Models Method Endpoint Description Status Code
Profile POST /profile/ This endpoint should allow to create a new Profile and store in database. 200
Profile Get /profile/:id This endpoint should allow to view profile by its id. 200
Comment GET /comment/ This endpoint should allow to view all comments with profileId. 200
Comment GET /comment/:profileId This endpoint should allow to view comments by profileId. 200
Comment POST /comment/ This endpoint should allow to create a new comment using profileId. 200
Comment POST /like/:commentId This endpoint should allow to like comments by commentId. 200
Comment POST /unlike/:commentId This endpoint should allow to unlike comments by commentId. 200

Schema

Profile Schema

{
  name: {
    type: String,
    required: true,
  },
  description: {
    type: String,
    required: true,
  },
  mbti: {
    type: String,
    required: true,
  },
  enneagram: {
    type: String,
    required: true,
  },
  variant: {
    type: String,
    required: true,
  },
  tritype: {
    type: Number,
    required: true,
  },
  socionics: {
    type: String,
    required: true,
  },
  sloan: {
    type: String,
    required: true,
  },
  psyche: {
    type: String,
    required: true,
  },
  image: {
    type: String,
    required: true,
  },
}

Comment Schema

{
  profileId: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Profile'
  },
  author: {
    type: String,
    required: true,
  },
  text: {
    type: String,
  },
  likes: {
    type: Number,
    default: 0 
  }
}

Contributing

If you'd like to contribute to this project, please follow these steps:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Create a new Pull Request