Code Monkey home page Code Monkey logo

project-happy-thoughts-api's Introduction

Project Happy Thoughts API

This project is a RESTful API for a simple Twitter-like app named "Happy Thoughts", which allows users to post, view, and like messages. It was built using Node.js, Express, MongoDB and deployed on Heroku.

The Problem

The main challenge of this project was designing an API that allows users to post messages, retrieve a list of the latest messages, and like a specific message. The API provides several routes for these actions.

Technologies used:

  • Node.js
  • Express
  • CORS
  • Mongoose
  • MongoDB
  • Render

Features:

  • Post a new message
  • Retrieve a list of the 20 latest messages
  • Like a specific message

MongoDB Schema:

A message (or thought) in the database is defined with the following properties:

  • message: A string that is required, should be between 5 and 140 characters and trimmed.
  • hearts: A number representing the likes on the message, defaults to 0.
  • createdAt: A date representing when the message was created, defaults to the current date.

Endpoints:

  • /Index route with a welcome message
  • /thoughts - GET route to retrieve the 20 latest messages, POST route to post a new message
  • /thoughts/:thoughtId/like - POST route to like a specific message

How to run the API locally:

Clone the repository Install dependencies with npm install Make sure MongoDB is installed and running Run the server with npm start Access the API at http://localhost:8080

API Deployed on Google Cloud:

https://project-happy-thoughts-api-kr5kua5o2a-lz.a.run.app/

The API is also connected to a React Frontend:

https://happy-thoughts-feed.netlify.app/

project-happy-thoughts-api's People

Contributors

camcron avatar emolsz 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.