Skip to content

This is the backend to my own Twitter version "Happy thoughts". I created an API using Express and MongoDb, which includes both GET and POST request endpoints

Notifications You must be signed in to change notification settings

nehrwein/project-happy-thoughts-api

 
 

Repository files navigation

Project Happy Thoughts API

In this project I am creating the backend of my own Twitter version, which is focussing on positiviy. It's called the "Happy thoughts API". I used Express and Mongodb to build an API which includes both GET request endpoints to return existing happy thoughts and POST endpoints to create data like new happy thoughts or increase likes on existing thoughts.

The API is communicating with a frontend I was building in an earlier project (https://nehrwein-happy-thoughts.netlify.app/).

Description

I have created the following endpoints:

  • GET '/' - start
  • GET '/endpoints' - provides all endpoints
  • GET '/thoughts' - endpoint returns a maximum of 20 thoughts, sorted by the time of creation to show the most recent thoughts first.
  • POST '/thoughts' - endpoint for posting new Happy Thoughts. Possibility to choose a category for the thought and add the author's name.
  • POST ':thoughtId/like' - endpoint to increase the amount of likes on each individual thought

Learnings:

  • How to use POST requests to send data to the API
  • How to store data in the database from POST requests
  • How to validate data and ensure the database only contains 'good' data
  • How to build a full API which includes handling of user input
  • How to build an API which works well with an existing frontend

View it live

Visit my deployed API here https://nehrwein-happy-thoughts-api.herokuapp.com

Documentation: https://documenter.getpostman.com/view/18068162/UVXdNe6K

Link to the frontend website https://nehrwein-happy-thoughts.netlify.app/

About

This is the backend to my own Twitter version "Happy thoughts". I created an API using Express and MongoDb, which includes both GET and POST request endpoints

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%