Skip to content

Bienfait-ijambo/wizard-engineer-laravel

Repository files navigation

Laravel Blog application

This is a Laravel 8 Project make sure you have a php version for that. Laravel documentation

Steps to run this project:

cd in laravel-blog and run :

  1. git clone https://github.com/Bienfait-ijambo/wizard-engineer-laravel.git

  2. cd in wizard-engineer-laravel

  3. Run composer install command

  4. Run php artisan migrate command for database

  5. Run php artisan serve command

NB: If you are not a laravel developper this is the Node Repo for final project []. If you are a laravel dev. make sure to create a env file and a db.

Api documentation

PUBLIC ENDPOINTS

POST

Endpoint

	/users

Request body

	{
	  "name": "string",
	  "email": "string",
	}

Response body

	{
		user: {
		  "name": "string",
		  "email": "string",
		},
		message:"user created !"
	}
	POST

Endpoint

	/users

Request body

	{
	  "email": "string",
	  "password": "string"
	}

Response body

If user provider invalid credentials

	{
		"isLogged":false,
		"message":"email or password invalid",
	}

If user provider valid credentials

	{
		user: {
		  "name": "ben",
		  "email": "[email protected]",
		},
		"isLogged":true,
		"message":"user logged",
		"token":"$2b$10$0O.pVCtZO2QgxfPKh0WNsudCHglKsoGwhJ0GXciLYzHCa73x99Gpa"
	}
	POST

Endpoint

	/logout

Request body

	{
		"userId": 1,
	}

Response body with status 200

	{
	  "message":"user logged out !"
	}

SECURED ENDPOINTS : admin

	POST

Endpoint

	/posts

Request body

	{
		"title": "What is TypeScript",
		"post_content":"content...."
	}

Response body with status 200

	{
	  "message":"Post created !"
	}
	PUT

Endpoint

	/posts/:id

Request body

	{
		"title": "What is TypeScript",
		"post_content":"content...."
	}

Response body with status 200

	{
	  "message":"Post created !"
	}
	DELETE

Endpoint

	/posts/:id

Request body

Response body with status 200

	{
	  "message":"Post deleted !"
	}
	POST

Endpoint

	/posts/upload-image

Request body

	{
		"postId": "number",
		"image":"binary"
	}

Response body with status 200

	{
	  "message":"Post image uploaded !"
	}

PUBLIC API : WEBSITES

This endpoints is used to display details of a single post

	GET

Endpoint

	/posts/:slug

Response body with status 200

[
	{
	"id": 8,
	"title": "What is TypeScript",
	"post_content": "<p></p>",
	"image": "http://127.0.0.1:8000/storage/images/1711706289.jpg",
	"slug": "what-is-typescript-xGckmQ1711806376",
	"created_at": "2024-03-11T17:44:03.000000Z",
	"updated_at": "2024-03-30T13:46:16.000000Z"
	}
]

Display list of posts on the home page of our vue app

	GET

Endpoint

	/posts?query=

Response body with status 200

{
	"data": [
		{
		"id": 3,
		"title": "What is Golang ?",
		"post_content": "<p>",
		"image": "http://127.0.0.1:8000/storage/images/1711706163.jpg",
		"slug": "what-is-golang-lZg1Ap1711810344",
		"created_at": "2024-03-10 14:32:29",
		"updated_at": "2024-03-30 14:52:24"
		}
	]
}

6. Return number of created posts

	GET

Endpoint

	/count/posts

Response body with status 200

{
	"data": 5
}

7. Check if user is logged in[return true or false]

	GET

Endpoint

	/check/user/loggedin

Response body with status 200

{
	"success": true
}

8. return a list of posts

	GET

Endpoint

	/client/posts

Response body with status 200

[
	
	{
		"id": 5,
		"title": "What is TypeScript",
		"post_content": "",
		"image": "http://127.0.0.1:8000/storage/images/1715743244.jpg",
		"slug": "what-is-typescript-8yXHkQ1715743297",
		"created_at": "2024-05-15 03:20:05",
		"updated_at": "2024-05-15 03:21:37"
	},

]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published