Code Monkey home page Code Monkey logo

backendchallenge's Introduction

Challenge

Create a web server with two endpoints:

Endpoint 1 (/process/*)

This endpoint must accept HTTP request sent using any of the methods (GET, POST, PUT, DELETE) and respond back with a JSON describing the request. To be specific the response JSON must contain the following fields

{
   time: //time when the request was received,
   method: //HTTP method used for making the request,
   headers: //HTTP headers in the request,
   path: //request path (will start with /process),
   query: //the parsed query string as key-values, if any
   body: //request body, if any
   duration: //time taken to process the request
}

You are to wait randomly between 15 to 30 seconds before sending back a response to any request. The random response time you choose is what needs to be populated in the duration field.

Endpoint 2 (/stats)

This endpoint must respond with the following real time statistics:

  • Total number of requests made since server startup and the average response time, classified by HTTP method.
  • Active number of requests, classified by HTTP method (eg: 3 GET requests, 4 POST requests, 5 PUT requests)
  • Number of requests and average response times, in the past hour, classified by HTTP method
  • Number of requests and average response times, in the past minute, classified by HTTP method

Here are somethings we're watching out for:

  • Code A clean and simple to follow codebase simply melts us.
  • Hosting Hosting the solution on the internet so that it's publicly accessible will be awesome.
  • Persistence Optional, but great if your stats dont reset themselves on the occassion of a server restart.
  • Websockets Optional, but a big big plus, and we are talking about the /stats endpoint. In this case, the /stats page will be reporting realtime statistics without having to refresh the page.

If you're up for the challenge, fork this repository and complete your entire solution there. Feel free to use any stack of your choice, and we're open to partial feature submissions as well. Just see it as an opportunity to know each other technically.

Happy hacking, and have fun!

backendchallenge's People

Contributors

navneethg avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.