- Run
git clone https://github.com/prateektakoria/paytm-insider-tech-task.git
- From the projects root run
cp .env.example .env
- Configure your
.env
file - Run
composer update
from the project's root folder - From the projects root folder run
php artisan key:generate
- From the projects root folder run
php artisan migrate
- From the projects root folder run
php artisan serve
- Now run the assigned URL in your browser. Everything is setup on the root url. e.g. localhost:8000/
You’ll get a list of all the groups after hitting this endpoint. You have to send the api_token as an Authorization header.
Here’s what we get when we hit this endpoint:
$ curl -X POST http://localhost:8000/api/register \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{"name": "Prateek Saini", "email": "[email protected]", "password": "12345678", "password_confirmation": "12345678"}' { "data": { "api_token":"0syHnl0Y9jOIfszq11EC2CBQwCfObmvscrZYo5o2ilZPnohvndH797nDNyAT", "created_at": "2019-08-20 21:17:15", "email": "[email protected]", "id": 51, "name": "Prateek Saini", "updated_at": "2019-08-20 21:17:15" } }
Here’s what we get when we hit this endpoint:
$ curl -X POST localhost:8000/api/login \ -H "Accept: application/json" \ -H "Content-type: application/json" \ -d "{\"email\": \"[email protected]\", \"password\": \"12345678\" }" { "data": { "id":1, "name":"Prateek Saini", "email":"[email protected]", "created_at":"2017-04-25 01:05:34", "updated_at":"2017-04-25 02:50:40", "api_token":"Jll7q0BSijLOrzaOSm5Dr5hW9cJRZAJKOzvDlxjKCXepwAeZ7JR6YP5zQqnw" } }
Here’s what we get when we hit this endpoint:
$ curl -X POST http://localhost:8000/api/logout \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer 0syHnl0Y9jOIfszq11EC2CBQwCfObmvscrZYo5o2ilZPnohvndH797nDNyAT" \ { "data": { "User Logged Out." } }
List of references i used to make this project