Code Monkey home page Code Monkey logo

currency_rates's Introduction

Currency Rates

Currency Rates is a test web application with import from XML source. This app is based on PHP framework "Laravel" version 8.x with using JS framework "Vue.js" to render front-office part.

Currency Rates Front-Office

Installation

  • Copy files on your server,
  • Create database,
  • Create a config file .env from .env.example and set database:
    DB_HOST=localhost
    DB_PORT=3306
    DB_DATABASE=your_database_name
    DB_USERNAME=root
    DB_PASSWORD=password
    
  • Go to root directory of this downloaded site,
  • Run npm install (If command npm is not found please read https://docs.npmjs.com/downloading-and-installing-node-js-and-npm),
  • Run composer install (If command npm is not found please read https://getcomposer.org/doc/00-intro.md),
  • Run php artisan key:generate to generate APP_KEY in the config file,
  • Run php artisan config:cache to clear cache in order to apply changes in the config file,
  • Run php artisan migrate in order to create tables in your database,
  • Setup your http server to the folder /public manually or run php artisan serve to start it on address http://localhost:8000/.

Usage

Please create a user by console command in order to log in to front-office part: Currency Rates Front-Office

Sample Data

You can clear and fill your data base with sample data by run a console command php artisan migrate:fresh --seed from your project root.

Console Commands

  • Import currencies with rates from XML: php artisan currency:import - a required argument is URL or path to XML file, read more by param --help, examples:
    • php artisan currency:import resources/test/XML_daily.xml
    • php artisan currency:import http://www.cbr.ru/scripts/XML_daily.asp
    • php artisan currency:import http://www.cbr.ru/scripts/XML_daily.asp?date_req=25/11/2020
  • Create new user: php artisan user:create - a required argument is username, read more by param --help, examples:
    • php artisan user:create admin - Create user admin with autogenerated password and email
    • php artisan user:create admin -p pass - Create user admin with password pass and with autogenerated email
    • php artisan user:create admin -e [email protected] - Create user admin with pass same as username and with provided email

API endpoints

You can use postman_collection.json and [postman_environment.json](docs/postman/Currency Rates.postman_environment.json) for quick review all implemented endpoints.

  • POST:/token, params: email, password // Generate new token for the user

The following endpoints require token authorization:

  • DELETE:/token // Clean up token from DB of the user
  • GET:/currency, params: page, page_size, date_from, date_to // Get currencies with related rates filtered by dates
  • GET:/currency/{id} // Get currency by ID
  • DELETE:/currency/{id} // Delete currency by ID
  • GET:/currency/{currencyId}/rate, params: page, page_size, date_from, date_to // Get rates with pagination filtered by dates
  • GET:/currency/{currencyId}/rate/{rateId} // Get rate by ID
  • DELETE:/currency/{currencyId}/rate/{rateId} // Delete rate by ID

Tests

Before run tests please create new from .env.testing from .env.sample and use separately created database in order to set it in the config DB_DATABASE there. Run command php artisan test.

Currency Rates Front-Office

Author: Yuriy Bakhtin

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.