The Movie API is a Spring Boot backend application designed to perform CRUD operations on a MongoDB database. It enables seamless management of movie records, including adding, updating, and deleting entries. Additionally, it facilitates user interaction by providing a feature to rate movies, enhancing the overall user experience and data functionality.
- SpringBoot
- MongoDB
-
Ensure Maven is installed: Verify Maven is installed and added to the
PATH.- Run:
mvn -v - If you see Maven's version details, it's correctly installed.
- Run:
-
Ensure JDK is installed: Maven requires JDK. Verify with:
- Run:
java -version
- Run:
-
Navigate to the project directory: Open Command Prompt and navigate to the directory containing your Maven project (
pom.xmlfile).
- Windows
- Download MongoDB Community Server from MongoDB's official website.
- Run the installer and follow the instructions:
- Choose "Complete" installation for default settings.
- Install MongoDB Compass for a graphical interface (optional).
- Add MongoDB's bin directory to your system’s PATH variable:
- Example:
C:\Program Files\MongoDB\Server\<version>\bin
- Example:
- macOS
- Install Homebrew if not already installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Install MongoDB using Homebrew:
brew tap mongodb/brew brew install mongodb-community
- Linux
- Import MongoDB's public GPG key:
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - - Add the MongoDB repository:
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
- Update the package database and install MongoDB:
sudo apt update sudo apt install -y mongodb-org
- Start MongoDB as a service:
- Open
services.msc, findMongoDB, and start it. - Alternatively, start it manually:
mongod
- Open
- Start MongoDB:
brew services start mongodb/brew/mongodb-community # OR on Linux sudo systemctl start mongod
To confirm MongoDB is running, use the Mongo shell:
mongoYou should see a prompt indicating that you are connected to the Mongo shell.
- Open the Mongo shell:
mongo
- Switch to (or create) a database:
Replace
use myDatabase
myDatabasewith your desired database name. - Insert a document to create the database:
db.myCollection.insertOne({ name: "Test", type: "Example" })
-
Import the Maven Project:
- Open IntelliJ IDEA.
- Click on File > Open, and select the project folder containing the
pom.xml. - IntelliJ will automatically detect the Maven project and import it.
-
Build the Project:
- Open the Maven tool window (usually on the right-hand side).
- Click on the Reload All Maven Projects button (🔄) to ensure dependencies are downloaded.
- Build the project by clicking Lifecycle > install or Lifecycle > package.
-
Run the Project:
- Locate the main class (
public static void main(String[] args)). - Right-click the main class file and select Run 'Main'.
- Locate the main class (
-
Import the Maven Project:
- Open Eclipse.
- Go to File > Import > Maven > Existing Maven Projects.
- Browse to the project folder and click Finish.
-
Build the Project:
- Right-click the project in the Project Explorer.
- Select Run As > Maven install or Maven build (then specify the goal, e.g.,
clean install).
-
Run the Project:
- Locate the main class (
public static void main(String[] args)). - Right-click the main class file and select Run As > Java Application.
- Locate the main class (
-
Install Required Extensions:
- Install the Maven for Java and Debugger for Java extensions.
-
Open the Project:
- Open VS Code.
- Navigate to the folder containing the
pom.xmlfile.
-
Build the Project:
- Open the Terminal (
Ctrl + ~), and run:mvn clean install
- Open the Terminal (
-
Run the Project:
- Locate the main class in the Explorer.
- Right-click the main class and select Run Java.
-
Open the Project:
- Open NetBeans.
- Go to File > Open Project, and select the folder containing the
pom.xml.
-
Build the Project:
- Right-click the project in the Projects window.
- Select Build with Dependencies.
-
Run the Project:
- Right-click the main class file and select Run File.
Each IDE has specific Maven support, but these general steps should work.
-
Navigate to the project directory:
cd path\to\your\project
-
Run the Maven install command:
mvn install
- This compiles the code, runs tests, and installs the built artifact (e.g.,
.jaror.warfile) to your local Maven repository (~/.m2/repository).
- This compiles the code, runs tests, and installs the built artifact (e.g.,
-
Optional Parameters:
- Skip Tests:
mvn install -DskipTests
- Clean and Install:
The
mvn clean install
cleancommand removes previous builds before installing the new one.
- Skip Tests:
-
Verify Installation:
- Check the
targetdirectory in your project for the generated files (e.g.,.jaror.war). - Verify the artifact is installed in your local Maven repository (
~/.m2/repository).
- Check the
- Fork the repository.
- Create a new branch:
git checkout -b feature-name. - Make your changes.
- Push your branch:
git push origin feature-name. - Create a pull request.
This project is licensed under the MIT License.