For using MongoDB in local machine
-
Install MongoDB
-
Set up the MongoDB environment. MongoDB requires a data directory to store all data. MongoDB’s default data directory path is \data\db. Before the first usage, you should create this folder. For more information visit https://docs.mongodb.com/getting-started/shell/installation/
-
In terminal window go to folder \MongoDB\Server\3.2\bin
-
Launch the server Mongo with command mongod
-
In another terminal window go to the same folder \MongoDB\Server\3.2\bin
-
Launch the MongoDB shell with command mongo
-
You can use command help to see available commands
-
Create user in the admin db
use admin db.createUser( { user: "root", pwd: "root", roles: [{role: "root", db: "admin"}, {role: "userAdminAnyDatabase", db: "admin"}] } )
-
Create or switch to the db gamification
use gamification
-
Create user in the gamification db
db.createUser( { user: "root", pwd: "root", roles: [{role: "dbAdmin", db: "gamification"}] } )
For building and launching application
- In the terminal window go to the project folder, use command gradle clean build. "BUILD SUCCESSFUL" means that build is successful :)
- You can find the built jar-file in gamification/build/libs, go to that folder
- Use command java -jar gamification-1.jar
- The string "Started Gamification" means the successful start. Default port – 8080.
- Open one of the helper programs to create and test custom HTTP requests-responses, e.g. "Advanced REST client"
- Choose the tab "Request", content-type - application/json.
- Follow the API. Important: the first - to add something, then - you can get it.
API