GithubHelp home page GithubHelp logo

project-happy-thoughts-api's Introduction

Happy Thoughts API ๐Ÿ’Œ

This project's goal was to build an API which includes both GET request endpoints to return data and POST endpoints to create data. For the front end I revisited my previous project Happy Thoughts a twitter like app where you can see other people's happy thoughts, post your own and give a โค๏ธ to an existing one. You can see the live version here, feel free to leave me some happy thoughts! Happy Thoughts

Planning & What I learned ๐Ÿงฉ

  • This Express API consists of a MongoDB stored in Atlas and deployed to Heroku
  • My first step in this project was to create the mongoose model for the Thought, the model schema consists of three main components: message, hearts and createdAt, with several validation rules embedded, i.e. required.
  • Used try and catch in all endpoints for error handling.

Endpoints ๐Ÿ’ซ

/

Root: Welcome page

GET /thoughts

Displays the latest 20 thoughts, sorted by createdAt to show the most recent thoughts first.

POST /thoughts

Endpoint to post and save a new thought to the database. It expects a JSON body with the thought message, like this: { "message": "Happy New Year!" }

POST /thoughts/:thoughtId/like

This endpoint doesn't require a JSON body. Given a valid thought id in the URL, the API should find that thought, and update its hearts property to add one heart.

Tech โšก๏ธ

  • MongoDB
  • Mongoose
  • Node.js
  • Express

View it live ๐Ÿ”ด

Happy Thoughts API ๐Ÿ’Œ

project-happy-thoughts-api's People

Contributors

sofiavazs avatar emolsz avatar dependabot[bot] avatar idlefingers 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.