https://github.com/samueladeogundev/oosd-rest-api
Object Oriented Software Development Certificate Project: Java REST API for Travel Rewards Management using Jakarta EE (JAX-RS) and JPA. Features complete CRUD operations, MariaDB persistence, and CORS support for cross-origin access. Built with Gson for JSON handling.
https://github.com/samueladeogundev/oosd-rest-api
jakarta-ee restful-api
Last synced: 6 months ago
JSON representation
Object Oriented Software Development Certificate Project: Java REST API for Travel Rewards Management using Jakarta EE (JAX-RS) and JPA. Features complete CRUD operations, MariaDB persistence, and CORS support for cross-origin access. Built with Gson for JSON handling.
- Host: GitHub
- URL: https://github.com/samueladeogundev/oosd-rest-api
- Owner: SamuelAdeogunDev
- Created: 2024-11-29T00:27:29.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-11-30T19:30:09.000Z (10 months ago)
- Last Synced: 2025-02-07T05:14:16.274Z (8 months ago)
- Topics: jakarta-ee, restful-api
- Language: Java
- Homepage:
- Size: 45.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Travel Rewards REST API
A Java-based REST API for managing travel rewards, built with Jakarta EE (JAX-RS) and JPA. This API provides complete CRUD operations for managing travel reward programs.
## Technologies Used
- Jakarta EE (JAX-RS) for REST endpoints
- JPA (Java Persistence API) for database persistence
- MariaDB as the database
- Gson for JSON serialization/deserialization
- CORS enabled for cross-origin requests### Option 1: Using XAMPP (Recommended for Local Development)
1. Install XAMPP if not already installed
2. Start Apache and MySQL services in XAMPP Control Panel
3. Access phpMyAdmin at http://localhost/phpmyadmin
4. Create a new database named `travelexperts`
5. Import the SQL file from `src/main/resources/database/travelexperts.sql`### Option 2: Using Standalone MariaDB
1. Install MariaDB Server from the official website
2. Create a new database named `travelexperts`
3. Import using command line:
```bash
mysql -u root -p travelexperts < src/main/resources/database/travelexperts.sql
```Note: This project uses default local development credentials. In a production environment, credentials would be properly secured using environment variables or secure configuration management.
## API Endpoints
### Get All Rewards
- **GET** `/api/rewards`
- Returns a list of all rewards in JSON format### Get Specific Reward
- **GET** `/api/rewards/get/{rewardId}`
- Returns a single reward by ID### Create New Reward
- **POST** `/api/rewards/post`
- Creates a new reward
- Requires JSON body with reward details### Update Reward
- **PUT** `/api/rewards/put`
- Updates an existing reward
- Requires JSON body with updated reward details### Delete Reward
- **DELETE** `/api/rewards/delete/{rewardId}`
- Deletes a reward by ID## Sample JSON Format
```json
{
"rwdName": "Gold Member",
"rwdDesc": "Special rewards for gold members"
}
```## Development Setup
1. Clone the repository
2. Set up the database using one of the options above
3. Configure database connection in `persistence.xml` if needed
- Default configuration uses local development settings
- For production, credentials should be externalized
4. Build and run the project using your preferred IDE## Security Note
This project demonstrates API development in a local environment. In a production setting:
- Database credentials would be managed through environment variables
- CORS settings would be more restrictive
- Additional security measures like authentication would be implemented## Cross-Origin Resource Sharing
This API includes CORS configuration to allow cross-origin requests, making it suitable for use with separate frontend applications (Web and Android clients).## Related Projects
- [Web Client Repository] - Web frontend application
- [Android Client Repository] - Mobile client application[Web Client Repository]: https://github.com/EsotericRazz/OOSD-JSP-Webpage
[Android Client Repository]: https://github.com/EsotericRazz/OOSD-Android-Client