Coder Social home page Coder Social logo

assignment2-webappdev2's Introduction

Assignment 2 - Web API.

Name: Sean Duggan W20064774

Features.

Everything from labs, plus...

  • Feature 1 - Added extra TMDB routes with parameterized URLs
  • Feature 2 - Extra database quieries to extend Mongo integration with Mongoose
  • Feature 3 - Private routes enforcing a login to use the app

Installation Requirements

Node and MongoDB will need to be installed and configured on the server/local machine.

1: Clone the repo, optionally via console;

git clone https://github.com/iodinex64/Assignment2-WebAppDev2.git

2: Install node with npm;

npm install

3: Run the program with npm.

npm start

API Configuration

You will need to create an .env file and place it in the root directory of the API folder. It should look something like this:

NODE_ENV=development
PORT=8080
HOST=localhost <or other if intended use is not local hosting>
TMDB_KEY=<your tmdb api key>
mongoDB=<your mongodb url>
SEED_DB=true
SECRET=<your jwt secret>

API Design

Give an overview of your web API design, perhaps similar to the following:

GET POST PUT DELETE
/api/movies Gets a list of movies N/A N/A N/A
/api/movies/{movieid} Get a Movie N/A N/A N/A
/api/movies/{movieid}/reviews Get all reviews for movie Create a new review for Movie N/A N/A
/api/genres Gets a list of all genres N/A N/A N/A
/api/users Gets a list of all users Creates a user Changes a user's details N/A
/api/users/{username} Get {username}'s details N/A N/A N/A
/api/users{username}/favourites Get {username}'s favourite movies Add an entry to {username}'s favourites list N/A N/A

Security and Authentication

JWT is used to authenticate user sessions. Passwords are hashed and salted. The user must first log in to use the app.

Integrating with React App

The react app this API was designed for is inside this repo, as it was updated to accomodate the API consequently. The old react app's repo can be found here: https://github.com/Iodinex64/wad2-moviesApp

The API communicates with it in the following fashion, replacing the old tmdb/stub implementation:

export const getMovies = () => {
  return fetch(
     '/api/movies',{headers: {
       'Authorization': window.localStorage.getItem('token')
    }
  }
  )
    .then(res => res.json())
    .then(json => {return json.results;});
};

assignment2-webappdev2's People

Contributors

iodinex64 avatar

Watchers

James Cloos avatar  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.