git clone https://github.com/hemanshuEng/Coffee-Drop-API.git
- install xampp and composer
- create database (coffeedrop)
- create .env file and add database credentials and without APP_KEY
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=coffeedrop DB_USERNAME=root DB_PASSWORD=
- run
php artisan key:generate
- create table
php artisan migrate
- run
php artisan DB:seed
- open postman and import this link https://www.getpostman.com/collections/163a2331d34d9c49f7c5
- get (path:url/api/locations) ,all locations data
- post(path:url/api/locations)
header
content-Type :application/json
accept :application/json
{ "postcode": "LE46NY", "opening_times": {"monday" : "09:00", "tuesday" :"09:00", "saturday" : "08:30"}, "closing_times": {"monday" : "19:00", "tuesday" : "19:00", "saturday" : "18:30"} }
- post (path:url/api/cashback)
content-Type :application/json
accept :application/json
{ "Ristretto":0, "Espresso":1000, "Lungo":0 }
response
{ "data": { "coffepod": { "Ristretto": 0, "Espresso": 1000, "Lungo": 0 }, "Cashback_pound": 100 } }
11.post (path:url/api/getnearestlocation)content-Type :application/json
accept :application/json
{ "postcode":"LA177UY" }
- CSV.thephpleague Documentation
used to import location data into database - jabranr/postcodes-io Documentaion
used to get geolocation information from postcodes.io
- Authentication
- web app using this api and leaflet.js to locate postcode on map
This website is built using laravel restfulAPI ,leaflet js is used to display shop location on map , bootstap framework is used for styling