Giter Site home page Giter Site logo

naterus / restful-countries Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 2.0 23.34 MB

Get countries information like states, flag, Covid19 stats, presidents and others via Restful API. Also packed with API monitoring/management Console and api documentation.

Home Page: https://restfulcountries.com

License: MIT License

Shell 0.02% PHP 3.70% Blade 4.05% Less 2.03% HTML 90.21%
countries-api countries-states countries-json countries-code states-api restful-api restfulcountries api-monitoring roles-permission-management rate-limiting

restful-countries's Introduction

License

Restful (JSON) Api to retrieve data about any country with an admin management console to monitor requests, manage country data, feedbacks, and admin users with roles and permissions, api documentation, api authentication:

Everything on https://restfulcountries.com has its source code available here except the data itself as it is hosted on a live database server.

Usage

Curl

curl -I https://restfulcountries.com/api/v1/countries?per_page=1  -H "Accept: application/json" -H "Authorization: Bearer Your-token"

Postman

Request access token to test api endpoints.

Documentation

See api documentation here - Api Docs

Running Locally

The current release of restful countries is built with Laravel Framework 7.29.3 and might need PHP 7.4+ to run smoothly.

If you wish to run the app for the purpose of contributing or just for personal use, you can follow these steps.

  1. Open your terminal and cd to any directory of your choice

    cd your-directory
  2. Clone this repository

    git clone https://github.com/Naterus/restful-countries.git
  3. cd into the folder created for cloned project:

    cd restful-countries
  4. Install packages with composer

    composer install
  5. Make a copy of .env.example as .env

    cp .env.example .env

    verify that .env has key APP_VERSION=1 or current api version.

  6. Generate app key

    php artisan key:generate
  7. Create an empty database and add the database credentials to .env file

        DB_DATABASE=your_database_name
        DB_USERNAME=root
        DB_PASSWORD=your_password
    
  8. Run migration

    php artisan migrate
  9. Run database seed to create sample data

    php artisan db:seed
  10. Create a public folder for symbolic link

mkdir storage/app/public
  1. Create a symbolic link to storage for asset uploads
php artisan storage:link
  1. Start laravel local server
php artisan serve
  1. open http://127.0.0.1:8000/ in your browser, You should see the home page of restful countries.

  2. Set up mailgun or mailtrap and add credentials to .env to enable application send api keys to mail.

  3. Navigate to http://127.0.0.1:8000/administrator/login, enter [email protected] as email and 12345 as password. you should be logged in as super admin user.

Testing

  1. Create test database
  2. Ensure you have created .env.testing file
  3. Update your database details. Example
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test_restful_countries
DB_USERNAME=root
DB_PASSWORD=
  1. Run test by running this command vendor\bin\phpunit or composer test

Contributing

This project is far from perfect, If you find a bug, or an optimal way of implementing an existing or new feature, Feel free to fork this repository, modify and create a pull request.

How can you contribute?

  • Update api documentation
  • Clean code (indentations,variable and function names)
  • Modify user interface
  • Optimize back-end code
  • Fix bug
  • Add new feature (Would be merged as new api version).

Note :

  • Ensure code is tested and well written before creating pull request.

  • Pull request should be modularized, you should not have too much code in one pull request. e.g if you are modifying documentation page and admin dashboard page, they should both be in different pull requests.

Appreciation

  • To sponsor this project, please visit donation page.
  • Help star this github repo.
  • Share repository link on twitter and other platforms.

License

Restful countries is an open-sourced software licensed under the MIT license.

restful-countries's People

Contributors

naterus avatar nellytadi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

restful-countries's Issues

Unable to get API key

There seems to be an issue indicating that it cannot send the email, so I'm unable to create a new API.

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.