Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
terazus authored Feb 19, 2019
1 parent b6d6999 commit 49a4b3b
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
1) clone repo
2) install composer (check https://getcomposer.org/)
3) Create an empty database (mysql, psql)
4) Go to repo, open .env and set your DB access and location:
4) Run your database server
5) Go to repo, open .env and set your DB access and location:
```sh
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
Expand All @@ -11,12 +12,12 @@
DB_USERNAME=login
DB_PASSWORD=password
```
5) Inside the repo do:
6) Inside the repo do:
```sh
$ composer install
$ composer require laravel/passport
$ php artisan passport:install
$ php artisan migrate:fresh --seed
$ php artisan passport:install
```
This will install all dependencies, migrate the database and feed its **records** and **users** tables with fake data.

Expand All @@ -26,6 +27,11 @@ To run the server do:
$ php artisan serve
```

To get all records:
```sh
$ curl -X GET -H -i http://localhost:8000/api/records
```

Once the app set up and the server is running, you will want to register a user with custom password and email:
```sh
$ curl -X POST -H 'Content-Type: application/json' -i http://localhost:8000/api/register --data '{"email": "email","password": "pwd","c_password": "pwd","name": "user Name"}'
Expand All @@ -36,16 +42,11 @@ To get your API key (with the login/password previously registered):
$ curl -X POST -H 'Content-Type: application/json' -i http://localhost:8000/api/login --data '{"email": "email","password": "pwd"}'
```

To get records (you will need an api key for this, only 5 records available):
To get a specific record (you will need an api key for this, only 5 records available) using its ID:
```sh
$ curl -X GET -H 'Authorization: Bearer YourAPIKey' -i http://localhost:8000/api/records/1
```

To get all records:
```sh
$ curl -X GET -H -i http://localhost:8000/api/records
```

To run unit tests, from the project directory:
```sh
$ ./vendor/bin/phpunit
Expand Down

0 comments on commit 49a4b3b

Please sign in to comment.