Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get endpoint path variables #258

Merged
merged 27 commits into from
May 17, 2024
Merged

get endpoint path variables #258

merged 27 commits into from
May 17, 2024

Conversation

sunb26
Copy link
Owner

@sunb26 sunb26 commented May 3, 2024

Done exams and moving to TO ready to get back on the grind :)

sunb26 added 5 commits May 2, 2024 16:51
* error with serve cmd from renovate updates. Re-populated pnpm-lock file
* switched to gorilla mux to extract path variables
* put variables in url path
@sunb26
Copy link
Owner Author

sunb26 commented May 3, 2024

I was having issues with running cmd/serve because I think renovate had made updates to pnpm-lock such that bazel was not supporting it anymore:

image

I tried running bazel cmds to update the file:

e.g
bazel run -- @pnpm//:pnpm --dir $PWD install --lockfile-only

but nothing seemed to work. I also changed the lockfile version manually in the file but then I started getting errors with the packages in the file saying I needed to include name and version fields for every single one of them.

My fix for this was re-generating the file from scratch. Now there are conflicts and from a quick glance it's because I am downgrading many of the versions. Wanted to get a second opinion before I just accept the older versions.

@sunb26 sunb26 requested review from Lev1ty and zackxzr May 3, 2024 15:47
@sunb26
Copy link
Owner Author

sunb26 commented May 3, 2024

added gorilla/mux dependency. Since we include variables in the URL path - gorilla mux provides a way to easily access the path variables without having to regex. The regular net/http library does not have support for this. Gorilla mux is also compatible with most types from the net/http library making the interaction between the two pretty easy.

@Lev1ty
Copy link
Collaborator

Lev1ty commented May 4, 2024

I was having issues with running cmd/serve because I think renovate had made updates to pnpm-lock such that bazel was not supporting it anymore:

image

I tried running bazel cmds to update the file:

e.g bazel run -- @pnpm//:pnpm --dir $PWD install --lockfile-only

but nothing seemed to work. I also changed the lockfile version manually in the file but then I started getting errors with the packages in the file saying I needed to include name and version fields for every single one of them.

My fix for this was re-generating the file from scratch. Now there are conflicts and from a quick glance it's because I am downgrading many of the versions. Wanted to get a second opinion before I just accept the older versions.

i have also been experiencing this. seems to be because renovate is using a newer version of pnpm, which supports a newer version of pnpm lockfile. in the meantime, i'm also doing what you're doing, havnig to either run pnpm i --lockfile-only or deleting the lockfile and regenerating. as long as the versions in the lockfile comply with the package files we're good. see aspect-build/rules_js#1652

@Lev1ty
Copy link
Collaborator

Lev1ty commented May 4, 2024

added gorilla/mux dependency. Since we include variables in the URL path - gorilla mux provides a way to easily access the path variables without having to regex. The regular net/http library does not have support for this. Gorilla mux is also compatible with most types from the net/http library making the interaction between the two pretty easy.

does the newer net/http package satisfy requirements? see

"mux.HandleFunc("GET /orders/{id}", func(w http.ResponseWriter, r *http.Request) {
    id := r.PathValue("id")
    fmt.Fprintf(w, "Get order with id: %s", id)
})"

// https://douglasmakey.medium.com/go-1-22s-http-package-updates-42aca70ceb9b#:~:text=mux.HandleFunc(%22GET%20%2Forders%2F%7Bid%7D%22%2C%20func(w%20http.ResponseWriter%2C%20r,order%20with%20id%3A%20%25s%22%2C%20id)%0A%7D)

@sunb26 sunb26 enabled auto-merge May 5, 2024 22:22
@sunb26
Copy link
Owner Author

sunb26 commented May 5, 2024

added gorilla/mux dependency. Since we include variables in the URL path - gorilla mux provides a way to easily access the path variables without having to regex. The regular net/http library does not have support for this. Gorilla mux is also compatible with most types from the net/http library making the interaction between the two pretty easy.

does the newer net/http package satisfy requirements? see

"mux.HandleFunc("GET /orders/{id}", func(w http.ResponseWriter, r *http.Request) {
    id := r.PathValue("id")
    fmt.Fprintf(w, "Get order with id: %s", id)
})"

// https://douglasmakey.medium.com/go-1-22s-http-package-updates-42aca70ceb9b#:~:text=mux.HandleFunc(%22GET%20%2Forders%2F%7Bid%7D%22%2C%20func(w%20http.ResponseWriter%2C%20r,order%20with%20id%3A%20%25s%22%2C%20id)%0A%7D)

Ahh cool I see this was pretty recent. Must have missed it thanks! Have removed the dependency and swithced back to just using net/http

@sunb26
Copy link
Owner Author

sunb26 commented May 5, 2024

I was having issues with running cmd/serve because I think renovate had made updates to pnpm-lock such that bazel was not supporting it anymore:
image
I tried running bazel cmds to update the file:
e.g bazel run -- @pnpm//:pnpm --dir $PWD install --lockfile-only
but nothing seemed to work. I also changed the lockfile version manually in the file but then I started getting errors with the packages in the file saying I needed to include name and version fields for every single one of them.
My fix for this was re-generating the file from scratch. Now there are conflicts and from a quick glance it's because I am downgrading many of the versions. Wanted to get a second opinion before I just accept the older versions.

i have also been experiencing this. seems to be because renovate is using a newer version of pnpm, which supports a newer version of pnpm lockfile. in the meantime, i'm also doing what you're doing, havnig to either run pnpm i --lockfile-only or deleting the lockfile and regenerating. as long as the versions in the lockfile comply with the package files we're good. see aspect-build/rules_js#1652

Unlucky :(

Copy link
Collaborator

@Lev1ty Lev1ty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zackxzr
Copy link
Collaborator

zackxzr commented May 6, 2024

Can you resolve merge conflicts @sunb26

@sunb26 sunb26 linked an issue May 16, 2024 that may be closed by this pull request
@sunb26 sunb26 merged commit 47a439c into main May 17, 2024
2 of 3 checks passed
@sunb26 sunb26 deleted the refactor-get-receipt-endpoint branch May 17, 2024 00:02
@zackxzr
Copy link
Collaborator

zackxzr commented May 17, 2024

lets goooooo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

receipt form api endpoints
3 participants