Code Monkey home page Code Monkey logo

social-network-api's Introduction

Social-Network-API

Description

An API for a social network that uses a NoSQL database so that the website can handle large amounts of unstructured data

Contents

Usage

GIVEN a social network API

  • WHEN I enter the command to invoke the application
    • THEN my server is started and the Mongoose models are synced to the MongoDB database
  • WHEN I open API GET routes in Insomnia for users and thoughts
    • THEN the data for each of these routes is displayed in a formatted JSON
  • WHEN I test API POST, PUT, and DELETE routes in Insomnia
    • THEN I am able to successfully create, update, and delete users and thoughts in my database
  • WHEN I test API POST and DELETE routes in Insomnia
    • THEN I am able to successfully create and delete reactions to thoughts and add and remove friends to a user’s friend list

Video Description

This application demonstrates the database for a social networking application. API routes are tested through Insomnia. Following demo's show various functionalities of the application.

  • This video shows the User and Friend Routes
USER-FRIENDS.mp4
  • This video shows the Thoughts and Reaction Routes
THOUGHTS-REACTIONS.mp4

Schema Description

  • User

    • username:

      • String
      • Unique
      • Required
      • Trimmed
    • email:

      • String
      • Required
      • Unique
      • Must match a valid email address (look into Mongoose's matching validation)
    • thoughts:

      • Array of _id values referencing the Thought model
    • friends:

      • Array of _id values referencing the User model (self-reference)
  • Thought

    • thoughtText:

      • String
      • Required
      • Must be between 1 and 280 characters
    • createdAt:

      • Date
      • Set default value to the current timestamp
      • Use a getter method to format the timestamp on query
    • username:

      • String
      • Required
    • reactions:

      • Array of nested documents created with the reactionSchema
  • Reaction

    • reactionId:

      • Use Mongoose's ObjectId data type
      • Default value is set to a new ObjectId
    • reactionBody:

      • String
      • Required
      • 280 character maximum
    • username:

      • String
      • Required
    • createdAt:

      • Date
      • Set default value to the current timestamp
      • Use a getter method to format the timestamp on query

Instructions

In the command line, run npm start to initiate server. NOTE: This repository consists of only the backend. The routes are located in the routes/api folder and can be tested with API test clients such as Insomnia Core or Postman.

Built With

  • Express.js
  • Mongoose
  • MongoDB
  • JavaScript

Credits

  • Created by Amir Hackett

social-network-api's People

Contributors

amir-hackett 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.