Giter Site home page Giter Site logo

team-kat's Introduction

Taste Buddies

⚙️ Project setup

Angular

  1. Navigate to the \TasteBuddiesClient folder and run npm install

Spring Boot

  • ❗ Open intelliJ to the team-kat/TasteBuddiesServer/ directory. This is required for IntelliJ to recognize the Gradle project and run it at all
  • You should have a gradle button on the right side of your window (once IntelliJ finishes loading the project). In the gradle menu launch the application with Tasks>application>bootRun. See here for instructions if you need help
  • Create the file TasteBuddiesServer/src/main/resources/application-dev.properties to hold the Google Places API key (ask Ricky, Brad, or Nathan if you need it)
    • This is a key=value pair in the form of apiKey = API_KEY_HERE
  • Edit your run configuration for TasteBuddiesServer [bootRun]. In the environment variables section add the line spring.profiles.active=dev;. This tells spring to launch with the dev profile enabled which reads the apiKey from application-dev.properties
  • Follow steps below for DB setup.

MySQL

  1. Create schema "taste-buddies".
  2. Create user and assign it CRUD permissions on taste-buddies schema.
  3. In your Java IDE, configure environment variables of your TasteBuddiesServer[bootrun] configuration to match your DB user. See this launchcode textbook page for how to configure those environment variables.

🔒 Authentication

Overview

Authenticaion is handled via JWTs (json web tokens). They have some advantages over cookies - see this article for some of the tradeoffs, but one large benefit is they allow the server to have no session state.

Related: Tutorial from Kat on Angular/Spring communication with JWT authentication

Tokens are valid for 24 hours from the time they are issued.

Implementation

Authentication is achieved by making a POST request to /api/auth/login
The body should contain a JSON object containing fields for email and password:

{
    "email": "[email protected]"
    "password": "userPassword"
}

Registration

New user accounts can be registered by making a POST request to /api/auth/register The body of the request should contain a JSON object with fields for displayName, email, and password:

{
    "displayName": "User's Name"
    "email": "[email protected]"
    "password": "userPassword"
}

Testing

Once there is a registered user in the DB, you should be able to make a GET request to /api/auth/authenticated and recieve a 200 response.

See the registration branch for a demo of registration, authentication, and accessing the api. Follow the project setup steps above, then make sure your java backend is running, your angular frontend is running, then navigate to localhost:4200 for the demo.

team-kat's People

Contributors

nathan-422 avatar beaiza avatar bruck71 avatar katsinskyd avatar rljt24 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.