@@ -11,10 +11,8 @@ Now for the fun part - creating actual endpoints! Each route is a small but migh
1111import { z } from " @hono/zod-openapi" ;
1212import { buildRoute } from " @vitnode/core/api/lib/route" ;
1313
14- import { CONFIG_PLUGIN } from " @/config" ;
1514
1615export const getCategoriesRoute = buildRoute ({
17- pluginId: CONFIG_PLUGIN .pluginId ,
1816 route: {
1917 method: " get" ,
2018 path: " /" ,
@@ -54,11 +52,9 @@ export const getCategoriesRoute = buildRoute({
5452``` ts title="plugins/blog/src/api/modules/categories/categories.module.ts"
5553import { buildModule } from " @vitnode/core/api/lib/module" ;
5654
57- import { CONFIG_PLUGIN } from " @/config" ;
5855import { getCategoriesRoute } from " ./routes/get.route" ; // [!code ++]
5956
6057export const categoriesModule = buildModule ({
61- pluginId: CONFIG_PLUGIN .id ,
6258 name: " categories" ,
6359 routes: [getCategoriesRoute ] // [!code ++]
6460});
@@ -75,10 +71,8 @@ import { z } from "@hono/zod-openapi";
7571import { buildRoute } from " @vitnode/core/api/lib/route" ;
7672import { HTTPException } from " hono/http-exception" ;
7773
78- import { CONFIG_PLUGIN } from " @/config" ;
7974
8075export const getCategoryByIdRoute = buildRoute ({
81- pluginId: CONFIG_PLUGIN .pluginId ,
8276 route: {
8377 method: " get" ,
8478 // [!code highlight]
@@ -136,10 +130,8 @@ Query parameters are your best friends for filtering, searching, and pagination.
136130import { z } from " @hono/zod-openapi" ;
137131import { buildRoute } from " @vitnode/core/api/lib/route" ;
138132
139- import { CONFIG_PLUGIN } from " @/config" ;
140133
141134export const searchCategoriesRoute = buildRoute ({
142- pluginId: CONFIG_PLUGIN .pluginId ,
143135 route: {
144136 method: " get" ,
145137 path: " /search" ,
@@ -203,7 +195,6 @@ When you need to send complex data (creating, updating), request bodies are your
203195import { z } from " @hono/zod-openapi" ;
204196import { buildRoute } from " @vitnode/core/api/lib/route" ;
205197
206- import { CONFIG_PLUGIN } from " @/config" ;
207198
208199const createCategorySchema = z .object ({
209200 name: z .string ().min (1 ).max (100 ).openapi ({
@@ -225,7 +216,6 @@ const createCategorySchema = z.object({
225216});
226217
227218export const createCategoryRoute = buildRoute ({
228- pluginId: CONFIG_PLUGIN .pluginId ,
229219 route: {
230220 method: " post" ,
231221 path: " /" ,
@@ -274,4 +264,4 @@ export const createCategoryRoute = buildRoute({
274264 return c .json (newCategory , 201 );
275265 }
276266});
277- ```
267+ ```
0 commit comments