Skip to content

Lindsay-Renna/lindsay-renna-capstone-api

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

FamTivity

FamTivity is an innovative web application designed to help families plan custom family nights based on their preferences, the number of children, and their ages. This project aims to bring families closer by providing tailored activity suggestions that cater to the unique dynamics of each family.

This is the backend server that supports the front-end application found at lindsay-renna-capstone

Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

This app is designed for:

  • Families with children of various ages seeking to enhance their quality time together.
  • Parents looking for easy and convenient ways to plan engaging activities.
  • Caregivers and educators interested in structured yet fun family activities.

(back to top)

Features

  • User registration and authentication
  • User maintained WatchList to remove watched movies from future results
  • Top 10 / popular movie/videogame/board games for families

Tech Stack

  • Client: React
  • Server: Node, Express
  • Database: MySQL
  • Authentication: OAuth, Passport.js
  • APIs: Movie and Video Game APIs for data retrieval, custom boardgame API using MySQL database

API Endpoints

Authentication GET /auth/github - Initiates GitHub OAuth authentication GET /auth/github/callback - Handles the callback from GitHub after authentication.

GET /auth/google - Initiates Google OAuth authentication GET /auth/google/callback - Handles the callback from Google after authentication

GET /auth/profile - Retrieves the authenticated user's profile information GET /auth/logout - Logs out the authenticated user

User Profile GET /users/:userId/watched-list - Retrieves the list of watched movies for a specific user POST /users/watched-list/add - Adds a movie to the user's watched list DELETE /users/:movieId - Removes a movie from the user's watched list

Boardgames GET /boardgames - Get first 40 boardgames GET /boardgames/popular - Get listing of popular boardgames for families GET /boardgames/id - Get boardgame details by boardgame ID POST /boardgames/results - Return a result of boardgames matching query params (Expand this section with more details about each endpoint as needed)

(back to top)

Getting Started

To get a local copy up and running follow these simple steps:

Prerequisites

  • Node.js (>=14.x.x)
  • git
  • MySQL

Installation

  1. Clone the repo

    git clone https://github.com/lindsay-renna/lindsay-renna-capstone-api.git
  2. Install dependencies

    npm install
  3. Create a new .env file with the following variables (see .env.example in the root folder). Replace the values with your values and local frontend PORT of choice

    //Port number on which the server will run
     PORT=8080
    
     //MySQL database connection settings
     DB_HOST=your_database_host
     DB_USER=your_database_user
     DB_PASSWORD=your_database_password
     DB_NAME=your_database_name
    
     //Session secret key for session management
     //You can enter any random string or word but to make it more secure you can generate one
     //generated by `node -e "console.log(require('crypto').randomBytes(32).toString('hex'));"`
     SESSION_SECRET=your_session_secret
    
     //GitHub Auth credentials
     GITHUB_CLIENT_ID=your_github_client_id
     GITHUB_CLIENT_SECRET=your_github_client_secret
     GITHUB_CALLBACK_URL=your_github_callback_url
    
     //Google Auth credentials
     GOOGLE_CLIENT_ID=your_google_client_id
     GOOGLE_CLIENT_SECRET=your_google_client_secret
     GOOGLE_CALLBACK_URL=your_google_callback_url
    
     //React App
     CLIENT_URL=http://localhost:5173
  4. Open a new terminal window and start the backend server.

    npm run start
  5. Complete the instructions fom the front-end repo.

  6. The application should now be running on http:https://localhost:5173 (frontend) and http:https://localhost:8080 (backend).

Database Setup

  1. Import the SQL file: Import the provided SQL file into your MySQL database. You can use a tool like MySQL Workbench or run the following command in your terminal:
mysql -u your_database_user -p your_database_name < path/to/your/sql/file.sql
  1. Configure Knex: Create a knexfile.js in the root directory with the following content:
import "dotenv/config";
import knex from "knex";

const db = knex({
	client: "mysql2",
	connection: {
		host: process.env.DB_HOST,
		database: process.env.DB_NAME,
		user: process.env.DB_USER,
		password: process.env.DB_PASSWORD,
		charset: "utf8",
	},
	migrations: {
		directory: "./migrations",
	},
});

export default db;
  1. Run Migrations: Ensure you have configured your knexfile.js correctly. Then run:
npx knex migrate:latest
  1. Run Seeds: To populate the database with initial data, run:

(back to top)

Usage

Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.

(back to top)

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Lindsay Renna - [email protected]

Project Link: https://github.com/lindsay-renna/lindsay-renna-capstone-api

(back to top)

Acknowledgments

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published