challenge from the club of developpers
Build an api backend application for an online learning plate-forme
To install this application run
git clone https://github.com/jocelinkisenga/E-learning.git
And navigate to the application folder then run
composer install
to install composer's dependances
To register a user, the end-point is /register , this end-point will return a bear token witch will be used for different requests.
{
name,
email,
password
}
To login a user the end-point is /login , this end-point will return a bear token witch will be used for different requests.
{
email,
password
}
To fetch all courses, the end-point is / whith the http method GET, this end-point returns an object of data related to courses.
{
"0": "all courses",
"course": [
{
"id": 23,
"owner_id": 5,
"title": "[email protected]",
"description": "jocelinkisenga",
"number_chapters": null,
"created_at": "2022-06-23T13:33:17.000000Z",
"updated_at": "2022-06-23T13:33:17.000000Z",
"image": "1655991197_téléchargement.jpeg"
},
{
"id": 22,
"owner_id": 3,
"title": "[email protected]",
"description": "jocelinkisenga",
"number_chapters": null,
"created_at": "2022-06-23T13:07:54.000000Z",
"updated_at": "2022-06-23T13:07:54.000000Z",
"image": "1655989674_téléchargement.jpeg"
},
{
"id": 21,
"owner_id": 4,
"title": "python",
"description": "learn python in one day and learn it well",
"number_chapters": null,
"created_at": "2022-06-23T12:56:36.000000Z",
"updated_at": "2022-06-23T12:56:36.000000Z",
"image": "1655988996_téléchargement.jpeg"
}],
}
To get a single course, use the end point /course/course_id/ , with the GET http method.
{
"course": [
{
"id": 23,
"owner_id": 5,
"title": "[email protected]",
"description": "jocelinkisenga",
"number_chapters": null,
"created_at": "2022-06-23T13:33:17.000000Z",
"updated_at": "2022-06-23T13:33:17.000000Z",
"image": "1655991197_téléchargement.jpeg"
},
],
}
to create a course you need first to make a request (permission) and let the admin allow you. The end-point for creating a course is /course , with the POST http method.
{
title,
description,
image
}
To request a permission get loged in first.
The end-point to ask for permission is /permissions, with the http method POST,
This end point helps you to create a course after it's allowed by the admin.
By defaut the after asking requesting a permission , the route for adding courses will be enabled, no need for the admin to confirm it
Images are stored in the folder uploads/images/ . use the link with an end-point like : /uploads/images/file_name
php v8 laravel 9
build with love by Jocelin kisenga from lushidev