Skip to content

IanMenzies/CurrencyExchange

Repository files navigation

README

ENDPOINT

http://localhost/laravel/public/index.php/currencyExchangeRate

GRAPH URL

http://localhost/laravel/public/index.php/currencyexchange/trendsgraph

REQUIREMENTS

  1. Redis server needs to be running off localhost port 6379. (Queues in laravel use Redis)
  2. Node JS running a) cd to laravel\public\nodejs b) node nodejs
  1. Ensure the queue listener is running in the background. a) php artisan queue:listen or b) php artisan queue:work --daemon --sleep=3 --tries=3

Running the queue listen command is CPU intesive so its recommended that you use a daemon.(View laravel 5 documents: http://laravel.com/docs/5.0/queues). Setting up allowed attempts is also recommended.

Technologies Used

I used Laravel 5 as the framework. This is my first encounter with the Laravel 5 framework. I usually use Zend Framework 2.

For this to be a real-time application I used 4 technologies. Redis, Nodejs, Chartjs, socketio which was the first time as well that I've dealt with all these technologies.

The areas covered in this application are:

  1. Receive the Json request.
  2. Ensure the request is correctly formatted.
  3. Ensure the same IP address hasnt made over X amount of requests within the hour(RateLimiter).
  4. Validate the request ensuring the data is correct data type.
  5. Once valid, the data is pushed to the queue(Redis)
  6. Once pushed to the queue it is then forwarded onto the handler to process the request.(Note 9 in a particular currency is considered a low Purchase)
  7. The request is then passed to a facade which passes the data to a currency exchange helper to determine any trends.(As I didnt have time the algorithm is atrociously basic here)
  8. The data is then passed to the facade again and formatted for the graph(Time-restraint meant that I just pass the array back)
  9. Once the above steps are performed then the app publish's the trends so that it can be used in the template to update the graph.(Time-restraint, ideally I wanted to move this to an event class)
  10. Socket.io Nodejs and Graphjs then work together to listen for a publish, when this happens an event occurrs and the updates the graph to display the data.(graph.js file needs a good bit of work to it. socket.io all the logic should be seperated out into their won functions for clarity and functionality purposes)

Ideally if I had more time I would've improved the sections mentioned above. I've also left some TODO's in the code where I would've of altercations.

Also would've implemented PHPunit tests. Testing the app CPU performance and how it handles x amount of requests per minute. Also testing the core functionality. TDD all the way.

About

Currency Exchange Request App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published