Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Documents backend architecture, RESTful API design, repository pattern, and database optimization for Node.js, Express, and Next.js APIs.
77% 86%+9 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 17 of 22 without it.
Could you help me set up role-based endpoint protection in my API? I need a TypeScript higher-order function that extracts the authorization token from incoming requests, verifies the user payload, and restricts route execution based on defined permission levels for user roles.
Uses standard Web Request or Response handler signatures rather than Express req, res, and NextFunction middleware arguments.
3 of 3 safety checks passed
用於可擴展伺服器端應用程式的後端架構模式和最佳實務。
// ✅ 基於資源的 URL
GET /api/markets # 列出資源
GET /api/markets/:id # 取得單一資源
POST /api/markets # 建立資源
PUT /api/markets/:id # 替換資源
PATCH /api/markets/:id # 更新資源
DELETE /api/markets/:id # 刪除資源
// ✅ 用於過濾、排序、分頁的查詢參數
GET /api/markets?status=active&sort=volume&limit=20&offset=0
// 抽象資料存取邏輯
interface MarketRepository {
findAll(filters?: MarketFilters): Promise<Market[]>
findById(id: string): Promise<Market | null>
create(data: CreateMarketDto): Promise<Market>
update(id: string, data: UpdateMarketDto): Promise<Market>
delete(id: string): Promise<void>
}
class SupabaseMarketRepository implements MarketRepository {
async findAll(filters?: MarketFilters): Promise<Market[]> {
let query = supabase.from('markets').select('*')
if (filters?.status) {
query = query.eq('status', filters.status)
}
Published skills whose descriptions closely match this one, with their benchmark result.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.