Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 1.05 KB

README.md

File metadata and controls

29 lines (19 loc) · 1.05 KB

Spring Boot MongoDB Sample

Spring Boot with MongoDB integration

Requirements

Quick start

  1. Import the project into Eclipse as Maven project
  2. Read MongoDB setup described below
  3. Find Application.java from side bar, right click on the file, select 'Run As' > 'Java Application' from menu.
  4. Make a POST request to http://localhost:8080/users with the payload: {"firstname":"Ben","lastname":"Linus","items":[{"itemName":"iPhone","quantity":1},{"itemName":"Apple","quantity":3}]}
  5. Make a GET request to http://localhost:8080/users
  6. There are more endpoints. For details, check UserController.java

MongoDB Setup

  1. Open Terminal or Command Prompt
  2. Run MongoDB: $ mongod --dbpath /YOUR/MONGODB/STORE/DIRECTORY
  3. On Eclipse, check the configuration file, Beans.java to point to your MongoDB