Skip to content

Commit

Permalink
move m&m endpoint under api prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
its-felix committed May 26, 2024
1 parent b224d9a commit c15bfb5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions go/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ func main() {
jsonConnEdp := web.NewConnectionsEndpoint(connHandler, "json")
pngConnEdp := web.NewConnectionsEndpoint(connHandler, "png")

e.Any("/api/milesandmore/*", web.NewMilesAndMoreHandler())

e.POST("/api/connections/json", jsonConnEdp)
e.GET("/api/connections/json/:payload", jsonConnEdp)
e.POST("/api/connections/png", pngConnEdp)
Expand All @@ -64,8 +66,6 @@ func main() {
e.GET("/data/airports.json", web.NewAirportsHandler(dataHandler))
e.GET("/data/aircraft.json", web.NewAircraftHandler(dataHandler))

e.Any("/milesandmore/*", web.NewMilesAndMoreHandler())

if err := run(ctx, e); err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion go/api/web/milesandmore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func NewMilesAndMoreHandler() echo.HandlerFunc {
}

outurl := "https://api.miles-and-more.com"
outurl += strings.TrimPrefix(req.URL.EscapedPath(), "/milesandmore")
outurl += strings.TrimPrefix(req.URL.EscapedPath(), "/api/milesandmore")
if req.URL.RawQuery != "" {
outurl += "?"
outurl += req.URL.RawQuery
Expand Down
2 changes: 1 addition & 1 deletion ui/src/lib/milesandmore/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class MilesAndMoreClient {

for (let i = 0; i < 3; i++) {
const resp = await this.httpClient.fetch(
`/milesandmore/flights/v1/${req.mode === Mode.BEST_BY_MONTH ? 'bestbymonth' : 'bestbyday'}`,
`/api/milesandmore/flights/v1/${req.mode === Mode.BEST_BY_MONTH ? 'bestbymonth' : 'bestbyday'}`,
{
method: 'POST',
body: JSON.stringify(request),
Expand Down
1 change: 0 additions & 1 deletion ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const proxyConfig: Record<string, string | ProxyOptions> = {
'/api/': localTarget('http://127.0.0.1:8080'),
'/auth/': localTarget('http://127.0.0.1:8080'),
'/data/': localTarget('http://127.0.0.1:8080'),
'/milesandmore/': localTarget('http://127.0.0.1:8080'),
};

export default defineConfig({
Expand Down

0 comments on commit c15bfb5

Please sign in to comment.