Travel Website Documentation
Travel Website Documentation
The application currently supports user login and automatic user creation if the user does
not already exist in the database.
3. Technologies Used
HTML, CSS, and JavaScript for the frontend.
Spring Boot (Java) for the backend.
MySQL/PostgreSQL for the database.
RESTful APIs for communication between frontend and backend.
VS Code as the IDE for development.
4. Website Features
Frontend:
- Responsive design with a clean user interface for login.
Backend:
- Login authentication system with user creation.
Database:
- Simple schema with fields for `sno`, `email`, and `password`.
5. Code Overview
### Login Authentication Logic
The following code snippet demonstrates how the application handles user login and
registration:
@PostMapping("/login")
public ResponseEntity<String> loginUser(@RequestBody User user) {
Optional<User> existingUser = userRepository.findByEmail(user.getEmail());
if (existingUser.isPresent()) {
return ResponseEntity.ok("User logged in successfully.");
} else {
userRepository.save(user);
return ResponseEntity.ok("New user created and logged in.");
}
}
6. Database Structure
The database schema consists of the following columns: