- CLI command to convert the input CSV file (see last section) to a JSON and XML file.
- REST API to serve the contents of the JSON file filterable by name and discount_percentage. Serving a filtered response in XML format.
- README file with anything you would like us to know about your solution and any future improvements you might make.
- Docker need to be installed on your machine.
- run
docker compose buildto build the necessary dependencies. - run
docker compose upto start the machine. - To ssh into the docker container there is a script in ./docker/shell.sh, on MacOS you can
sh ./docker/shell.sh. - Once in the default directory /var/www/html, run
composer install, all the necessary packages will be installed. - After the installation scripts of composer please create config file,
.env, in the root directory of the project - When the installation completes, all the available cli commands can be accessed using
php artisanwhile in the root directory via the terminal. - Web server can be accessed using http://localhost.
- Since we are using an
.envfile, the "database" (json file) can be configured using hte keyCSV_FILE, in-case there needs to be any path changes - the full path needs to given - There is a sample
.envfile called.env.examplethat can be used as a template
GET /api/listings| Parameter | Type | Description |
|---|---|---|
name |
string |
optional. Filters by name |
discount_percentage |
string |
optional. Filters by discount percentage |
php artisan app:convert {file} {formats=xml,json} {outputFilename}This command will create the necessary files for the web api to read and serve.
- Lumen Framework (lite framework with a quick router)
- PHP 7.2
- main csv file is under the storage folder
- run tests using the
composer testcommand while the active directory is the project root. - all tests are available in the tests folder.
- Adding Auth System using JWT
- Using a database (maybe sqlite) to complete the CURD operations.
- Move the api to JSON.
- Depending on the volume of data, we could implement a cache system.