Flask中模型、SQLAlchemy和超链接API的使用
1. 理解和配置资源路由
在Flask应用中,资源路由的配置是实现RESTful API的关键步骤。不同的HTTP动词和请求范围对应着不同的类和方法。以下是具体的对应关系:
| HTTP动词 | 范围 | 类和方法 |
|---|---|---|
| GET | 通知集合 | NotificationListResource.get |
| GET | 单个通知 | NotificationResource.get |
| POST | 通知集合 | NotificationListResource.post |
| PATCH | 单个通知 | NotificationResource.patch |
| DELETE | 单个通知 | NotificationResource.delete |
| GET | 通知类别集合 | Notification |
超级会员免费看
订阅专栏 解锁全文
1135

被折叠的 条评论
为什么被折叠?



