File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import getApiRoutes from './utilities/file-scan.js';
55import serverPage from './utilities/server-page.js' ;
66import logPage from './utilities/log-page.js' ;
77import { deleteLogs } from './utilities/logger.js' ;
8+ import { apiList } from './utilities/api-list.js' ;
89import { env } from './utilities/env.js' ;
910
1011const { apiHandlers, apiRoutes } = await getApiRoutes ( ) ;
@@ -13,6 +14,7 @@ const httpServer = createServer(
1314 ...apiHandlers ,
1415 ...serverPage ( apiRoutes ) ,
1516 ...logPage ( ) ,
17+ ...apiList ( apiRoutes ) ,
1618) ;
1719
1820// Delete any logs on server start if the DELETE_LOGS_ON_SERVER_RESTART env var is set to 'ON'
Original file line number Diff line number Diff line change 1+ import { http , HttpResponse } from 'msw' ;
2+ import { prefix } from './env' ;
3+ const apiList = ( apiList : string [ ] = [ '1' , '2' , '3' ] ) => [
4+ http . get ( `/api` , ( ) => {
5+ const apiPaths = apiList . map ( ( path ) => `/${ prefix } ${ path } ` ) ;
6+ return HttpResponse . json ( apiPaths ) ;
7+ } ) ,
8+ ] ;
9+
10+ export { apiList } ;
Original file line number Diff line number Diff line change @@ -509,7 +509,10 @@ const homePage = (apiPaths: string[]) => [
509509 } ) ;
510510 } ) ,
511511 http . get ( `/ping` , ( ) => {
512- return new HttpResponse ( null , { status : 200 } ) ;
512+ return HttpResponse . json (
513+ { response : 'server is running' } ,
514+ { status : 200 } ,
515+ ) ;
513516 } ) ,
514517] ;
515518
You can’t perform that action at this time.
0 commit comments