This repository is part of assignment for Backend Developer.
This document contains information on how to install, and setup this assignment script.
To install this script, run the below commands
$ git clone https://github.com/kalpeshmahida/BackendDeveloperAssignment.git
$ cd BackendDeveloperAssignment
$ composer install
If you want to run the script using built-in server, execute this command
$ php bin/console server:run
Run this command specifying API-KEY to retrive the data from the last 3 days from nasa api.
NOTE: It is assumed parameters.yml is configured with mysql details and specified database in details is created already.
It is important to run below command to populate data in database before proceeding further
$ bin/console doctrine:schema:create
$ php bin/console neo:feed API-KEY
The command is implemented inside AppBundle\Command\NeoFeedCommand
AppBundle\Controller\DefaultController
- the index method returns {"hello":"world!"}
Neo SDK
- Inside src\Neo
basic rest client implementation to access nasa api
/api/doc
- is the route to access API documentation
/neo/hazardous
- implemented into hazardousAction
method of ApiBundle\Controller\AsteroidController
/neo/fastest?hazardous=(true|false)
- implemented into fastestAction
method of ApiBundle\Controller\AsteroidController
/neo/best-year?hazardous=(true|false)
- implemented into bestYearAction
method of ApiBundle\Controller\AsteroidController
/neo/best-month?hazardous=(true|false)
- implemented into bestMonthAction
method of ApiBundle\Controller\AsteroidController
To run all tests
$ phpunit
To run home page test
$ phpunit tests/AppBundle/Controller/DefaultControllerTest.php
To run Webservices tests
$ phpunit tests/ApiBundle/Controller/AsteroidControllerTest.php
- Exception handling
- Returning proper error responses
/neo/hazardous
API - using pagination- More generic feed command which can be used to fetch feed by specifying date range.
- A command to retrive / fetch more historic data from nasa api, to make analysis on local data real and accurate
- Unit testing for Neo SDK
The assignment is configured with the following Symfony bundles and third party PHP libs apart from Symfony's default distribution:
- FOSRestBundle - To add rest functionality
- NelmioApiDocBundle - To generate API documentation
- GuzzleHttp - As a base HTTP client for NEO api SDK
- DoctrineExtensions - A set of extensions to Doctrine 2 that add support for additional query functions like YEAR, EXTRACT etc.