This is a simple backend application to be used for developer interview assignment at Aras™ Digital Products.
The application is implemented using Node.js and Express.js in combination with MongoDB as its database.
The complete application with the database can be built and run using the regular Docker flow, based on the provided Dockerfile.
If you need direct database access, it is possible to spin up a MongoDB instance using docker-compose. Provided docker-compose.yml specification will run the database and expose it on localhost:27017.
The backend application can be run using npm run dev. This mode of operation uses nodemon, which redeploys the application on every file change. The application can also be run with npm start to ignore file changes. The application runs on port 3000.
Database connection is configured in src/db.js. Connection string defaults to mongodb://localhost:27017/interview-assignment-db. Optionally, it is possible to provide MONGO_HOST and MONGO_PORT environemnt variables to be used instead of localhost and 3000, respectively. There is no authentication needed to access the database.
The current data is generated using a short Python script that can be found at db/article_generator.py. The script uses Faker to generate random content and saves it to articles.json file.
Application run using the provided Dockerfile will automatically import data from db/articles.json.
If you wish to add more data, data in JSON format can be imported into the database using mnongoimport command, e.g. mongoimport --db interview-assignment-db --collection articles --file articles.json --jsonArray (note that this will only add data, and not replace it).
API spec can be found on Github Pages and/or on /api-docs endpoint of the running server.
If you run into any issues, have a suggestion or just want to improve the application, please submit an issue on the Issues page or contact us via email. If you run into an issue and know how to fix it, you are more than welcome to submit a pull request.