- Navigate to the \TasteBuddiesClient folder and run
npm install
- ❗ 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
- This is a key=value pair in the form of
- 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.
- Create schema "taste-buddies".
- Create user and assign it CRUD permissions on taste-buddies schema.
- 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.
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.
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"
}
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"
}
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.