API demonstrating an implementation of MANY-TO-MANY relationship between students and courses with Laravel
- Clone the repository using
git clone https://github.com/tosinibrahim96/User-Courses-API.git
- Create a
.env
file in the root folder and copy everything from.env-sample
into it - Fill the
.env
values with your Database details as required
- Download WAMP or XAMPP to manage APACHE, MYSQL and PhpMyAdmin. This also installs PHP by default. You can follow this tutorial
- Download and install composer globally on your system
install all project dependencies and generate application key
$ composer install
$ php artisan key:generate
migrate all tables and seed required data into the database
$ php artisan migrate:fresh --seed
generate a JWT_SECRET value in your
.env
file. This will be used for JWT authentication
$ php artisan jwt:secret
start your Apache server and MySQL on WAMP or XAMPP interface generate a JWT_SECRET value in your
.env
file. This will be used for JWT authentication
$ php artisan jwt:secret
serve your project using the default laravel PORT or manually specify a PORT
$ php artisan serve (Default PORT)
$ php artisan serve --port={PORT_NUMBER} (setting a PORT manually)
Endpoint | Request Type | Payload |
---|---|---|
{BASE_URL}/api/v1/auth/register | POST | name,email,password |
{BASE_URL}/api/v1/auth/login | POST | email,password |
{BASE_URL}/api/v1/auth/logout | POST | Bearer {Token} |
{BASE_URL}/api/v1/courses | POST | Bearer {Token} |
{BASE_URL}/api/v1/courses | GET | Bearer {Token} |
{BASE_URL}/api/v1/courses/export | GET | Bearer {Token} |
{BASE_URL}/api/v1/user/register-courses | POST | Bearer {Token}, courses(Array containing course(s) id e.g [1,4,5]) |
- MIT license
- Copyright 2020 © Ibrahim Alausa.