brick.ts
All examples

Resource plugin

A comments plugin built with defineResourcePlugin that attaches a typed comments namespace and CRUD routes to a parent resource.

  • Plugins
  • CRUD
  • SQLite

1 services · 8 actions · 2 tables · 9 files

Open in GitHub

Features

  • defineResourcePlugin and resource extensions
  • Write hooks that trim and validate input
  • Compiled HTTP routes for list, count, update and delete

Service graph

TablesServiceResources and actionspages1 colscomments3 colspage0 actionspageComment8 actionspagessqlite

Actions and routes

pages

MethodPathActionAccess
POST/api/pageComment/querypageComment.listpublic
GET/api/pageComment/:idpageComment.getpublic
POST/api/pageCommentpageComment.createpublic
PATCH/api/pageComment/:idpageComment.updatepublic
DELETE/api/pageComment/:idpageComment.deletepublic
POST/api/pageComment/find-onepageComment.findOnepublic
POST/api/pageComment/countpageComment.countpublic
POST/api/pageComment/existspageComment.existspublic

Database tables

pages
idtextPK
comments
idtextPK
target_idtextNOT NULL
bodytextNOT NULL

Source

Loading source…

Run it

The server listens on port 3001.