Skip to content

Instantly share code, notes, and snippets.

@glendmaatita
Last active August 30, 2021 13:07
Show Gist options
  • Save glendmaatita/459a7454aef6d9fb608d4d95cce5e2b4 to your computer and use it in GitHub Desktop.
Save glendmaatita/459a7454aef6d9fb608d4d95cce5e2b4 to your computer and use it in GitHub Desktop.
Backend Recruitment Test

We already have fake server here. This fake server will return a list of users in certain format like this.

{
  "data": [
    {
      "id": 1,
      "name": "Leanne Graham",
      "username": "Bret",
      "email": "Sincere@april.biz",
      "address": {
        "street": "Kulas Light",
        "suite": "Apt. 556",
        "city": "Gwenborough",
        "zipcode": "92998-3874",
        "geo": {
          "lat": "-37.3159",
          "lng": "81.1496"
        }
      },
      "phone": "1-770-736-8031 x56442",
      "website": "hildegard.org",
      "company": {
        "name": "Romaguera-Crona",
        "catchPhrase": "Multi-layered client-server neural-net",
        "bs": "harness real-time e-markets"
      }
    },
    {
      "id": 2,
      "name": "Ervin Howell",
      "username": "Antonette",
      "email": "Shanna@melissa.tv",
      "address": {
        "street": "Victor Plains",
        "suite": "Suite 879",
        "city": "Wisokyburgh",
        "zipcode": "90566-7771",
        "geo": {
          "lat": "-43.9509",
          "lng": "-34.4618"
        }
      },
      "phone": "010-692-6593 x09125",
      "website": "anastasia.net",
      "company": {
        "name": "Deckow-Crist",
        "catchPhrase": "Proactive didactic contingency",
        "bs": "synergize scalable supply-chains"
      }
    },
    ...
  ]
}

All you need to do is create a middleware (using any language and framework you prefer) that has some functionalities for:

  1. Dynamic filter using query parameters for name, username, email, address, & phone:

    http://[your-middleware-url]?filter[name]=agung&filter[email]=biz
    

    That query parameter above will return all users whose name contain agung and email contain biz word.

    Another example:

    http://[your-middleware-url]?filter[address][street]=arjuna
    

    That query parameter above will return all users whose address street contain arjuna word.

  2. Pagination using query parameter

    http://[your-middleware-url]?paging[page]=1&paging[limit]=5
    

    That query parameter above will return 5 users from page 1

Push your codes to github, and save in a repository with name: imp-backend-[your-name]. DON'T forget to add a clear README.md that contains a detail instruction how to run your program

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment