File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ Host: api.acme.com
3131
3232** Alternative endpoint:**
3333``` http
34- GET /api/v1/discovery HTTP/1.1
34+ GET /api/v1 HTTP/1.1
3535```
3636
3737** Response:**
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export function createHonoApp(options: ObjectStackHonoOptions) {
4444
4545 // --- 0. Discovery Endpoint ---
4646 app . get ( prefix , ( c ) => {
47- return c . json ( dispatcher . getDiscoveryInfo ( prefix ) ) ;
47+ return c . json ( { data : dispatcher . getDiscoveryInfo ( prefix ) } ) ;
4848 } ) ;
4949
5050 // --- 1. Auth ---
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export class ObjectStackController {
8787 // --- Discovery Endpoint ---
8888 @Get ( )
8989 discovery ( ) {
90- return this . service . dispatcher . getDiscoveryInfo ( '/api' ) ;
90+ return { data : this . service . dispatcher . getDiscoveryInfo ( '/api' ) } ;
9191 }
9292
9393 @Post ( 'graphql' )
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export function createRouteHandler(options: NextAdapterOptions) {
5151
5252 // --- 0. Discovery Endpoint ---
5353 if ( segments . length === 0 && method === 'GET' ) {
54- return NextResponse . json ( dispatcher . getDiscoveryInfo ( options . prefix || '/api' ) ) ;
54+ return NextResponse . json ( { data : dispatcher . getDiscoveryInfo ( options . prefix || '/api' ) } ) ;
5555 }
5656
5757 try {
Original file line number Diff line number Diff line change 77} from '@objectstack/spec/api' ;
88import { HonoHttpServer } from './adapter' ;
99import { createHonoApp } from '@objectstack/hono' ;
10+ import { HttpDispatcher } from '@objectstack/runtime' ;
1011import { serveStatic } from '@hono/node-server/serve-static' ;
1112import * as fs from 'fs' ;
1213import * as path from 'path' ;
@@ -123,8 +124,9 @@ export class HonoServerPlugin implements Plugin {
123124
124125 // Register Standard Discovery Endpoint
125126 const rawApp = this . server . getRawApp ( ) ;
127+ const dispatcher = new HttpDispatcher ( kernel ) ;
126128 rawApp . get ( '/.well-known/objectstack' , ( c ) => {
127- return c . redirect ( apiPath ) ;
129+ return c . json ( { data : dispatcher . getDiscoveryInfo ( apiPath ) } ) ;
128130 } ) ;
129131 ctx . logger . debug ( 'Registered standard discovery endpoint' , { path : '/.well-known/objectstack' , target : apiPath } ) ;
130132
Original file line number Diff line number Diff line change @@ -203,12 +203,26 @@ export class MSWPlugin implements Plugin {
203203 // Discovery Endpoint
204204 this . handlers . push (
205205 http . get ( '*/.well-known/objectstack' , ( ) => {
206- return new HttpResponse ( null , {
207- status : 302 ,
208- headers : {
209- Location : baseUrl
206+ if ( this . dispatcher ) {
207+ return HttpResponse . json ( {
208+ data : this . dispatcher . getDiscoveryInfo ( baseUrl )
209+ } ) ;
210+ }
211+ return HttpResponse . json ( {
212+ data : {
213+ version : 'v1' ,
214+ apiName : 'ObjectStack API' ,
215+ url : baseUrl ,
216+ capabilities : {
217+ graphql : false ,
218+ search : false ,
219+ websockets : false ,
220+ files : false ,
221+ analytics : false ,
222+ hub : false
223+ }
210224 }
211- } )
225+ } ) ;
212226 } )
213227 ) ;
214228
You can’t perform that action at this time.
0 commit comments