Before starting the application, make sure you have a connection to a mongodb server.
For example, it can present on localhost on port number 27017. Add two system environment variables:
export MONGODB_HOST=localhost
export MONGODB_PORT=27017The code uses these environment variables to get credentials for connecting to the MongoDB server.
Make sure you have Java version 11 or more, and Maven installed.
Use Maven to build the project:
mvn installFollowing this, you can run it as follows:
mvn exec:javaThis will start the Java Spark server, which listens on localhost at port 4567.
To add a user, we can use the provided python script as follows:
python3 sendGetandPostRequest.py 1 <username> <password>The 1 is a token which means that a user has to be added. Say we add a user as follows:
python3 sendGetandPostRequest.py 1 namanv3 badPasswordNow, we can login with the same credentials as follows:
python3 2 namanv3 badPasswordFollow the instructions to add files, and retreive them too.