Task:

Create a basic REST API enabling CRUD operations with respect to basic information about the host system.

Requirements:

  • Either a Rails or Django application

  • Use the native auth system (i.e. the basic one that comes with Rails or Django) to secure all routes.

  • Has a SQLite DB with a table named `requests` that has the following columns:

  1. id (viz. autoincrementing int)

  2. type of request (e.g. GET, POST, PUT, DELETE)

  3. time of request (datetime)

  4. comment (text, NULL by default)

  • Has the following routes:

    • /: index page, which upon a GET request…

      • …creates a new entry in the `requests` table logging the request.

      • …and displays:

        • A table listing the last 10 times the page was loaded.

        • Results of running the shell commands `date` and `cat /proc/cpuinfo`.

    • /api/:id

      • GET: displays the info for the request with ID=:id, returning a 404 if the entry is not found.

      • POST: sets the `comment` for the request with ID=:id with the submitted payload, returning a 200 if successful, else a 400.

      • PUT: return a 405.

      • DELETE: removes the entry with ID=:id, returning a 200 if successful and a 400 if not.

Notes:

  • Use username:password for any credentials

  • You may assume the app will run in a Debian based Linux distro

  • You may use any additional frameworks or libraries as you deem necessary.

  • You may reuse your own code from prior work

  • You may use code snippets from other authors but they must be annotated in comments, and they must not constitute wholesale copying (to be arbitrated by Geosite engineers)

Evaluation criteria:

  • Functionality: Does the submission meet all the functional requirements?

  • Idiomatics: Are your code and configuration files idiomatic i.e. do they follow standard conventions for the software/framework/language chosen? E.g. if using Django, do you make use of viewsets, and is your code Pythonic?

  • Discussion: Be prepared to discuss your submission during the interview process


Please save your work as a public git repo and submit the link with your cover letter.