File tree Expand file tree Collapse file tree 3 files changed +8
-14
lines changed
components/webui/server/src
fastify-v2/routes/api/example Expand file tree Collapse file tree 3 files changed +8
-14
lines changed Original file line number Diff line number Diff line change 66import settings from "../settings.json" with { type : "json" } ;
77import DbManager from "./plugins/DbManager.js" ;
88import S3Manager from "./plugins/S3Manager.js" ;
9- import exampleRoutes from "./routes/example.js" ;
109import queryRoutes from "./routes/query.js" ;
1110import staticRoutes from "./routes/static.js" ;
1211
@@ -59,7 +58,6 @@ const FastifyV1App: FastifyPluginAsync<AppPluginOptions> = async (
5958
6059 // Register the routes
6160 await fastify . register ( staticRoutes ) ;
62- await fastify . register ( exampleRoutes ) ;
6361 await fastify . register ( queryRoutes ) ;
6462} ;
6563
Original file line number Diff line number Diff line change 1- import { TypeBoxTypeProvider } from "@fastify/type-provider-typebox" ;
1+ import { FastifyPluginAsyncTypebox } from "@fastify/type-provider-typebox" ;
22import { Type } from "@sinclair/typebox" ;
3- import { FastifyPluginAsync } from "fastify" ;
43
54
65/**
76 * Creates example routes.
87 *
9- * @param app
8+ * @param fastify
109 */
11- const routes : FastifyPluginAsync = async ( app ) => {
12- const fastify = app . withTypeProvider < TypeBoxTypeProvider > ( ) ;
13-
10+ const plugin : FastifyPluginAsyncTypebox = async ( fastify ) => {
1411 fastify . get ( "/example/get/:name" , {
1512 schema : {
1613 params : Type . Object ( {
@@ -32,4 +29,4 @@ const routes: FastifyPluginAsync = async (app) => {
3229 } ) ;
3330} ;
3431
35- export default routes ;
32+ export default plugin ;
Original file line number Diff line number Diff line change 1+ import fastify from "fastify" ;
12import { StatusCodes } from "http-status-codes" ;
23import tap , { Test } from "tap" ;
34
4- import { build } from "./tap .js" ;
5+ import routes from "../fastify-v2/routes/api/example/index .js" ;
56
67
78tap . test ( "Tests the example routes" , async ( t : Test ) => {
8- const server = await build ( t ) ;
9+ const server = fastify ( ) ;
10+ server . register ( routes ) ;
911
1012 let resp = await server . inject ( {
1113 method : "GET" ,
@@ -23,6 +25,3 @@ tap.test("Tests the example routes", async (t: Test) => {
2325 t . equal ( resp . statusCode , StatusCodes . OK ) ;
2426 t . match ( JSON . parse ( resp . body ) , { msg : String } ) ;
2527} ) ;
26-
27- // eslint-disable-next-line no-warning-comments
28- // TODO: Add tests for `query` routes.
You can’t perform that action at this time.
0 commit comments