@@ -12,7 +12,7 @@ import type {
12
12
TokenAnalytics ,
13
13
} from './types' ;
14
14
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 ' ;
16
16
17
17
class ApiError extends Error {
18
18
constructor (
@@ -98,12 +98,12 @@ async function fetchApi<T>(
98
98
export const api = {
99
99
// Commit endpoints
100
100
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 } ` ) ,
103
103
104
104
// 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 } ` ) ,
107
107
getEnvironmentsForBinary : ( binaryId : string ) =>
108
108
fetchApi <
109
109
Array < {
@@ -113,7 +113,7 @@ export const api = {
113
113
run_count : number ;
114
114
commit_count : number ;
115
115
} >
116
- > ( `/api/ binaries/${ binaryId } /environments` ) ,
116
+ > ( `/binaries/${ binaryId } /environments` ) ,
117
117
getCommitsForBinaryAndEnvironment : (
118
118
binaryId : string ,
119
119
environmentId : string
@@ -127,19 +127,19 @@ export const api = {
127
127
python_version : { major : number ; minor : number ; patch : number } ;
128
128
run_timestamp : string ;
129
129
} >
130
- > ( `/api/ binaries/${ binaryId } /environments/${ environmentId } /commits` ) ,
130
+ > ( `/binaries/${ binaryId } /environments/${ environmentId } /commits` ) ,
131
131
132
132
// Environment endpoints
133
- getEnvironments : ( ) => fetchApi < Environment [ ] > ( '/api/ environments' ) ,
133
+ getEnvironments : ( ) => fetchApi < Environment [ ] > ( '/environments' ) ,
134
134
getEnvironment : ( id : string ) =>
135
- fetchApi < Environment > ( `/api/ environments/${ id } ` ) ,
135
+ fetchApi < Environment > ( `/environments/${ id } ` ) ,
136
136
137
137
// Python version endpoints
138
138
getPythonVersions : ( ) =>
139
- fetchApi < PythonVersionFilterOption [ ] > ( '/api/ python-versions' ) ,
139
+ fetchApi < PythonVersionFilterOption [ ] > ( '/python-versions' ) ,
140
140
141
141
// Benchmark endpoints
142
- getAllBenchmarks : ( ) => fetchApi < string [ ] > ( '/api/ benchmarks' ) ,
142
+ getAllBenchmarks : ( ) => fetchApi < string [ ] > ( '/benchmarks' ) ,
143
143
getBenchmarkNames : ( params : {
144
144
environment_id : string ;
145
145
binary_id : string ;
@@ -152,7 +152,7 @@ export const api = {
152
152
queryParams . append ( 'python_major' , params . python_major . toString ( ) ) ;
153
153
queryParams . append ( 'python_minor' , params . python_minor . toString ( ) ) ;
154
154
155
- return fetchApi < string [ ] > ( `/api/ benchmark-names?${ queryParams . toString ( ) } ` ) ;
155
+ return fetchApi < string [ ] > ( `/benchmark-names?${ queryParams . toString ( ) } ` ) ;
156
156
} ,
157
157
158
158
// Diff endpoint
@@ -168,7 +168,7 @@ export const api = {
168
168
queryParams . append ( 'environment_id' , params . environment_id ) ;
169
169
queryParams . append ( 'metric_key' , params . metric_key ) ;
170
170
171
- return fetchApi < DiffTableRow [ ] > ( `/api/ diff?${ queryParams . toString ( ) } ` ) ;
171
+ return fetchApi < DiffTableRow [ ] > ( `/diff?${ queryParams . toString ( ) } ` ) ;
172
172
} ,
173
173
174
174
// Upload endpoint
@@ -183,7 +183,7 @@ export const api = {
183
183
} ;
184
184
benchmark_results : BenchmarkResultJson [ ] ;
185
185
} ) =>
186
- fetchApi < { success : boolean } > ( '/api/ upload' , {
186
+ fetchApi < { success : boolean } > ( '/upload' , {
187
187
method : 'POST' ,
188
188
body : JSON . stringify ( data ) ,
189
189
} ) ,
@@ -209,7 +209,7 @@ export const api = {
209
209
high_watermark_bytes : number ;
210
210
total_allocated_bytes : number ;
211
211
} >
212
- > ( `/api/ trends?${ queryParams . toString ( ) } ` ) ;
212
+ > ( `/trends?${ queryParams . toString ( ) } ` ) ;
213
213
} ,
214
214
215
215
// Batch trends endpoint
@@ -232,7 +232,7 @@ export const api = {
232
232
total_allocated_bytes : number ;
233
233
} >
234
234
> ;
235
- } > ( '/api/ trends-batch' , {
235
+ } > ( '/trends-batch' , {
236
236
method : 'POST' ,
237
237
body : JSON . stringify ( {
238
238
trend_queries : trendQueries . map ( ( query ) => ( {
@@ -247,7 +247,7 @@ export const api = {
247
247
248
248
// Flamegraph endpoint
249
249
getFlamegraph : ( id : string ) =>
250
- fetchApi < { flamegraph_html : string } > ( `/api/ flamegraph/${ id } ` ) ,
250
+ fetchApi < { flamegraph_html : string } > ( `/flamegraph/${ id } ` ) ,
251
251
252
252
// Token management endpoints
253
253
getTokens : ( ) =>
0 commit comments