Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CORS #118

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"ExpandedNodes": [
"",
"\\src",
"\\src\\backend"
],
"SelectedNode": "\\352.pod",
"PreviewInSolutionExplorer": false
}
Binary file not shown.
Binary file added .vs/bounswe2024group10/v17/.wsuo
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"java.configuration.updateBuildConfiguration": "interactive",
"java.compile.nullAnalysis.mode": "automatic"
}
10 changes: 10 additions & 0 deletions src/backend/animaltroove/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM maven:latest
WORKDIR /app
COPY pom.xml .
RUN mvn dependency:go-offline
COPY src src
RUN mvn package -DskipTests
FROM openjdk:21-jdk
WORKDIR /app
COPY --from=0 /app/target/animaltroove-0.0.1-SNAPSHOT.jar .
CMD ["java", "-jar", "animaltroove-0.0.1-SNAPSHOT.jar"]
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ public class RegisteredUserController {
@Autowired
private LoginService loginService;

@CrossOrigin(origins = "*", allowedHeaders = "*")
@PostMapping("/register")
public ResponseEntity<RegisteredUser> registerUser(@RequestBody RegisteredUser newUser) {
RegisteredUser registeredUser = registrationService.registerNewUser(newUser);
return new ResponseEntity<>(registeredUser, HttpStatus.CREATED);
}

@CrossOrigin(origins = "*", allowedHeaders = "*")
@PostMapping("/login")
public ResponseEntity<LoginResponse> loginUser(@RequestBody LoginRequest user) {
LoginResponse loggedInUser = loginService.loginUser(user.getUserName(), user.getPassword());
Expand Down