Giter Club home page Giter Club logo

mongodb-social-api's Introduction

Description

An custom built API that utilizes MongoDB and Mongoose to manage basic back-end functionality for a very simple social media application. I built this as an excercise in familiarizing myself with MongoDb (and Mongoose), as well as building an application with the MVC (model-view-controller) design pattern. Prior to this excercise, I was building API's by implementing all of the CRUD methods within the API calls themselves, but after working with Mongoose, I have found that putting all of that functionality in the controllers is much more intuitive since it leaves the API route files a lot cleaner, letting them do their thing. Learning this was initially a bit difficult, but after I understood how to modularize the seperate functionality it basically wrote itself. The big hang-ups I had were with designing how I should nest and associate the models and documents in the database. Specifically, I struggled with associating users with their "thoughts" (posts) and whether or not I should have reactions to thoughts also be associated with users. Once I realized that I could just push data into the various arrays whenever an API call is made, it all made sense.

Uploading Untitled_ Apr 7, 2024 9_07 PM.webm…

Installation

  • Run npm install in the root directory of the repo to grab all of the required packages.
  • Run npm util/seed-data to seed some data with some very minimal data and users.

Usage

I utilized Insomnia to test out the various API routes, but you can also use Postman. Make sure you seed the data first.

mongodb-social-api's People

Contributors

umbelth94 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.