Go 1.22 router upgrade #37

Open
opened 2024-02-10 23:42:01 +00:00 by noah · 0 comments
Owner

In Go 1.22 the standard library HTTP router supports path parameters and method names.

This ticket tracks the changes to the code to upgrade it to use the new features.

Renamed Routes

Some routes are moved to better names to utilize the path parameters nicely.

Old Route New Route
/friends/u/{username} /u/{username}/friends
/photo/u/{username} /u/{username}/photos
/notes/u/{username} /u/{username}/notes

The old routes will redirect to the new ones.

Methods Added

Endpoint methods have been specified for the following endpoints (which, in their controller functions, did not mix GET and POST logic together). All endpoints need to be tested to ensure not broken:

  • GET /favicon.ico
  • GET /manifest.json
  • GET /about
  • GET /features
  • GET /faq
  • GET /tos
  • GET /privacy
  • GET /logout
  • GET /settings/confirm-email
  • GET /markdown
  • GET /test/geo-gate
  • GET /account/reactivate
  • GET /u/{username}
  • GET /u/{username}/friends
  • GET /u/{username}/photos
  • GET /photo/view
  • GET /photo/private
  • GET /messages
  • GET /messages/read/{id}
  • GET /friends
  • POST /users/block
  • GET /users/blocked
  • GET /users/blocklist/add
  • GET /comments/subscription
  • GET /admin/unimpersonate
  • GET /inner-circle
  • GET /photo/gallery
  • GET /members
  • GET /forum
  • GET /forum/thread/{id}
  • GET /forum/newest
  • GET /forum/search
  • GET /f/{fragment}
  • POST /poll/vote
  • GET /admin
  • GET /v1/version
  • GET /v1/users/me
  • POST /v1/users/check-username
  • POST /v1/likes
  • GET /v1/likes/users
  • POST /v1/notifications/read
  • POST /v1/notifications/delete
  • GET /v1/comment-photos/remove-orphaned
  • POST /v1/barertc/report
  • POST /v1/barertc/profile
  • GET /go/comment
  • GET /static/
  • GET /friends/u/{s}
  • GET /photo/u/{s}
  • GET /notes/u/{s}
In Go 1.22 the standard library HTTP router supports path parameters and method names. This ticket tracks the changes to the code to upgrade it to use the new features. ### Renamed Routes Some routes are moved to better names to utilize the path parameters nicely. | Old Route | New Route | |---------------|-----------------| | /friends/u/{username} | /u/{username}/friends | | /photo/u/{username} | /u/{username}/photos | | /notes/u/{username} | /u/{username}/notes | The old routes will redirect to the new ones. ### Methods Added Endpoint methods have been specified for the following endpoints (which, in their controller functions, did not mix GET and POST logic together). All endpoints need to be tested to ensure not broken: * [x] GET /favicon.ico * [x] GET /manifest.json * [x] GET /about * [x] GET /features * [x] GET /faq * [x] GET /tos * [x] GET /privacy * [x] GET /logout * [x] GET /settings/confirm-email * [x] GET /markdown * [x] GET /test/geo-gate * [x] GET /account/reactivate * [x] GET /u/{username} * [x] GET /u/{username}/friends * [x] GET /u/{username}/photos * [x] GET /photo/view * [x] GET /photo/private * [x] GET /messages * [x] GET /messages/read/{id} * [x] GET /friends * [x] POST /users/block * [x] GET /users/blocked * [x] GET /users/blocklist/add * [x] GET /comments/subscription * [x] GET /admin/unimpersonate * [x] GET /inner-circle * [x] GET /photo/gallery * [x] GET /members * [x] GET /forum * [x] GET /forum/thread/{id} * [x] GET /forum/newest * [x] GET /forum/search * [x] GET /f/{fragment} * [x] POST /poll/vote * [x] GET /admin * [x] GET /v1/version * [x] GET /v1/users/me * [x] POST /v1/users/check-username * [x] POST /v1/likes * [x] GET /v1/likes/users * [x] POST /v1/notifications/read * [x] POST /v1/notifications/delete * [ ] GET /v1/comment-photos/remove-orphaned * [x] POST /v1/barertc/report * [x] POST /v1/barertc/profile * [x] GET /go/comment * [x] GET /static/ * [x] GET /friends/u/{s} * [x] GET /photo/u/{s} * [x] GET /notes/u/{s}
noah added the
enhancement
label 2024-02-10 23:42:01 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nonshy/website#37
No description provided.