This repository contains a simple CRUD application built using the Play Framework with Scala. The application allows users to perform Create, Read, Update, and Delete operations on a sample dataset.
Before running the project, ensure you have the following installed:
- Java Development Kit (JDK): Version 8 or higher.
- Scala: Version 2.13.x or compatible with the Play Framework version used.
- SBT (Scala Build Tool): Version 1.5.x or higher.
- Database: (Optional) Configure your preferred database (e.g., PostgreSQL, MySQL).
git clone https://github.com/your-username/play-scala-crud.git
cd play-scala-crud
Run the following command to build the project and download all required dependencies:
sbt compile
Start the application in development mode:
sbt run
The application will start and be available at http://localhost:9000
.
To configure the database, update the application.conf
file in the conf
directory. Example configuration for a PostgreSQL database:
db.default.driver = org.postgresql.Driver
db.default.url = "jdbc:postgresql://localhost:5432/your_database"
db.default.username = "your_username"
db.default.password = "your_password"
Ensure you have the correct database driver dependency in your build.sbt
file:
libraryDependencies += "org.postgresql" % "postgresql" % "42.6.0"
To run the application in production mode:
- Build the application:
sbt dist
- Extract the generated zip file in the
target/universal
directory. - Run the extracted binary:
./your-app-name/bin/your-app-name -Dplay.http.secret.key="your-secret-key"
- Create: Add new entries to the database.
- Read: View existing entries.
- Update: Modify existing entries.
- Delete: Remove entries.
Method | Endpoint | Description |
---|---|---|
POST | /create |
Create a new record. |
GET | /list |
Retrieve all records. |
PUT | /update/:id |
Update a specific record. |
DELETE | /delete/:id |
Delete a specific record. |
This project is licensed under the MIT License. See the LICENSE
file for details.
Contributions are welcome! Feel free to submit issues or pull requests.