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

Add type to HTTP method and status enum #30

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nickbar01234
Copy link
Collaborator

@nickbar01234 nickbar01234 commented Oct 23, 2023

Description

Add "quality-of-life" enhancement to backend development.

  1. fetch HTTP request methods are constrained to GET, POST, PUT, PATCH, and DELETE. These methods align with Next.js route handlers specifications. Typescript can now provide us type hints

    image

  2. Add a enum for common status code that I anticipated would be useful for our development. The idea is that it's easier to understand the intent of the status code from the enums, instead of trying to remember what all the numbers represent.

Possible Downsides

The type-hint for HTTP request methods doesn't raise a compilation error with typo - i.e someone can still type a bogus HTTP method.

@vercel
Copy link

vercel bot commented Oct 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
the-legacy-project2 ✅ Ready (Inspect) Visit Preview Oct 23, 2023 4:27pm

@nickbar01234 nickbar01234 added the enhancement New feature or request label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant