Laravel + VueJS
此项目只是整个应用的的API部分,SPA部分请查看:https://github.com/Qsnh/CloudBookMark-SPA
一、下载到本地:
git clone https://github.com/Qsnh/CloudBookMark.git
二、安装依赖
composer install
三、生成 key
php artisan key:generate
四、配置 .env
文件
五、安装数据表
php artisan migrate
六、安装 Laravel Passport
授权客户端
php artisan passport:install
七、配置前端App。
方法 | 接口 | 解释 |
---|---|---|
POST | /oauth/token | 获取AccessToken |
GET | /api/v1/user | 获取用户信息 |
GET | /api/v1/user?include=categories | 获取用户信息 + 分类 |
GET | /api/v1/user?include=categories.bookmarks | 获取用户信息 + 分类 + 书签 |
方法 | 接口 | 解释 |
---|---|---|
GET | /api/v1/category | 获取所有分类 |
GET | /api/v1/category?include=bookmarks | 获取分类 + 书签 |
POST | /api/v1/category/add | 添加分类 |
GET | /api/v1/category/{id}/find | 查找单个分类 |
DELETE | /api/v1/category/{id}/delete | 删除分类 |
POST | /api/v1/category/{id}/edit | 编辑分类 |
方法 | 接口 | 解释 |
---|---|---|
GET | /api/v1/bookmark | 获取书签 |
GET | /api/v1/bookmark?include=category | 获取书签 + 分类 |
POST | /api/v1/bookmark/add | 添加书签 |
DELETE | /api/v1/bookmark/{id}/delete | 删除书签 |
{
"code": 0 | 1,
"error": success | error,
"message": "说明信息",
"data": object,
}
Bearer access_token
注意 Bearer 后面有个空格
参数 | 说明 | 默认值 |
---|---|---|
grant_type | 授权方式 | password |
client_id | 客户端ID | 空 |
client_secret | 客户端secret | 空 |
username | 用户名 | 空 |
password | 密码 | 空 |
scope | 权限范围 | 空 |
参数 | 说明 | 默认值 |
---|---|---|
category_name | 分类名 | 空 |
参数 | 说明 | 默认值 |
---|---|---|
category_name | 分类名 | 空 |
参数 | 说明 | 默认值 |
---|---|---|
category_id | 分类ID | 空 |
bookmark_name | 书签名 | 空 |
bookmark_url | 书签地址 | 空 |
注意,所有的API均支持跨域操作,如要关闭,请进行如下操作:
第一、删除 config/app.php
中的 Barryvdh\Cors\ServiceProvider::class,
。
第二、删除 app/Http/kernel.php
中的 \Barryvdh\Cors\HandleCors::class,
。
===============================
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation give you tools you need to build any application with which you are tasked.
Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The Laravel documentation is thorough, complete, and makes it a breeze to get started learning the framework.
If you're not in the mood to read, Laracasts contains over 900 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library.
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at [email protected]. All security vulnerabilities will be promptly addressed.
The Laravel framework is open-sourced software licensed under the MIT license.