@@ -12,7 +12,7 @@ import type {
1212 TokenAnalytics ,
1313} from './types' ;
1414
15- const API_BASE = process . env . NEXT_PUBLIC_API_BASE || 'http://localhost:8000' ;
15+ const API_BASE = process . env . NEXT_PUBLIC_API_BASE || 'http://localhost:8000/api ' ;
1616
1717class ApiError extends Error {
1818 constructor (
@@ -98,12 +98,12 @@ async function fetchApi<T>(
9898export const api = {
9999 // Commit endpoints
100100 getCommits : ( skip : number = 0 , limit : number = 100 ) =>
101- fetchApi < Commit [ ] > ( `/api/ commits?skip=${ skip } &limit=${ limit } ` ) ,
102- getCommit : ( sha : string ) => fetchApi < Commit > ( `/api/ commits/${ sha } ` ) ,
101+ fetchApi < Commit [ ] > ( `/commits?skip=${ skip } &limit=${ limit } ` ) ,
102+ getCommit : ( sha : string ) => fetchApi < Commit > ( `/commits/${ sha } ` ) ,
103103
104104 // Binary endpoints
105- getBinaries : ( ) => fetchApi < Binary [ ] > ( `/api/ binaries?_t=${ Date . now ( ) } ` ) ,
106- getBinary : ( id : string ) => fetchApi < Binary > ( `/api/ binaries/${ id } ` ) ,
105+ getBinaries : ( ) => fetchApi < Binary [ ] > ( `/binaries?_t=${ Date . now ( ) } ` ) ,
106+ getBinary : ( id : string ) => fetchApi < Binary > ( `/binaries/${ id } ` ) ,
107107 getEnvironmentsForBinary : ( binaryId : string ) =>
108108 fetchApi <
109109 Array < {
@@ -113,7 +113,7 @@ export const api = {
113113 run_count : number ;
114114 commit_count : number ;
115115 } >
116- > ( `/api/ binaries/${ binaryId } /environments` ) ,
116+ > ( `/binaries/${ binaryId } /environments` ) ,
117117 getCommitsForBinaryAndEnvironment : (
118118 binaryId : string ,
119119 environmentId : string
@@ -127,19 +127,19 @@ export const api = {
127127 python_version : { major : number ; minor : number ; patch : number } ;
128128 run_timestamp : string ;
129129 } >
130- > ( `/api/ binaries/${ binaryId } /environments/${ environmentId } /commits` ) ,
130+ > ( `/binaries/${ binaryId } /environments/${ environmentId } /commits` ) ,
131131
132132 // Environment endpoints
133- getEnvironments : ( ) => fetchApi < Environment [ ] > ( '/api/ environments' ) ,
133+ getEnvironments : ( ) => fetchApi < Environment [ ] > ( '/environments' ) ,
134134 getEnvironment : ( id : string ) =>
135- fetchApi < Environment > ( `/api/ environments/${ id } ` ) ,
135+ fetchApi < Environment > ( `/environments/${ id } ` ) ,
136136
137137 // Python version endpoints
138138 getPythonVersions : ( ) =>
139- fetchApi < PythonVersionFilterOption [ ] > ( '/api/ python-versions' ) ,
139+ fetchApi < PythonVersionFilterOption [ ] > ( '/python-versions' ) ,
140140
141141 // Benchmark endpoints
142- getAllBenchmarks : ( ) => fetchApi < string [ ] > ( '/api/ benchmarks' ) ,
142+ getAllBenchmarks : ( ) => fetchApi < string [ ] > ( '/benchmarks' ) ,
143143 getBenchmarkNames : ( params : {
144144 environment_id : string ;
145145 binary_id : string ;
@@ -152,7 +152,7 @@ export const api = {
152152 queryParams . append ( 'python_major' , params . python_major . toString ( ) ) ;
153153 queryParams . append ( 'python_minor' , params . python_minor . toString ( ) ) ;
154154
155- return fetchApi < string [ ] > ( `/api/ benchmark-names?${ queryParams . toString ( ) } ` ) ;
155+ return fetchApi < string [ ] > ( `/benchmark-names?${ queryParams . toString ( ) } ` ) ;
156156 } ,
157157
158158 // Diff endpoint
@@ -168,7 +168,7 @@ export const api = {
168168 queryParams . append ( 'environment_id' , params . environment_id ) ;
169169 queryParams . append ( 'metric_key' , params . metric_key ) ;
170170
171- return fetchApi < DiffTableRow [ ] > ( `/api/ diff?${ queryParams . toString ( ) } ` ) ;
171+ return fetchApi < DiffTableRow [ ] > ( `/diff?${ queryParams . toString ( ) } ` ) ;
172172 } ,
173173
174174 // Upload endpoint
@@ -183,7 +183,7 @@ export const api = {
183183 } ;
184184 benchmark_results : BenchmarkResultJson [ ] ;
185185 } ) =>
186- fetchApi < { success : boolean } > ( '/api/ upload' , {
186+ fetchApi < { success : boolean } > ( '/upload' , {
187187 method : 'POST' ,
188188 body : JSON . stringify ( data ) ,
189189 } ) ,
@@ -209,7 +209,7 @@ export const api = {
209209 high_watermark_bytes : number ;
210210 total_allocated_bytes : number ;
211211 } >
212- > ( `/api/ trends?${ queryParams . toString ( ) } ` ) ;
212+ > ( `/trends?${ queryParams . toString ( ) } ` ) ;
213213 } ,
214214
215215 // Batch trends endpoint
@@ -232,7 +232,7 @@ export const api = {
232232 total_allocated_bytes : number ;
233233 } >
234234 > ;
235- } > ( '/api/ trends-batch' , {
235+ } > ( '/trends-batch' , {
236236 method : 'POST' ,
237237 body : JSON . stringify ( {
238238 trend_queries : trendQueries . map ( ( query ) => ( {
@@ -247,7 +247,7 @@ export const api = {
247247
248248 // Flamegraph endpoint
249249 getFlamegraph : ( id : string ) =>
250- fetchApi < { flamegraph_html : string } > ( `/api/ flamegraph/${ id } ` ) ,
250+ fetchApi < { flamegraph_html : string } > ( `/flamegraph/${ id } ` ) ,
251251
252252 // Token management endpoints
253253 getTokens : ( ) =>
0 commit comments