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

Improve api template #68256

Open
wants to merge 14 commits into
base: canary
Choose a base branch
from
Open

Conversation

Tim-Zj
Copy link

@Tim-Zj Tim-Zj commented Jul 29, 2024

What?

  • Updated .env.example file to include additional environment variables for API configuration and miscellaneous settings.
  • Added route.js to configure API routes using the App Router, including handling of GET, POST, PUT, and DELETE methods.

Why?

  • To provide a more comprehensive example for developers, making it easier to configure and manage environment variables.
  • To enhance the API routes configuration by setting body size limits and enabling CORS with specific HTTP methods, improving security and flexibility.
  • To align with the App Router approach as recommended by the Next.js documentation.

How?

  • Modified .env.example to include API_BASE_URL, API_VERSION, NODE_ENV, and PORT.
  • Added route.js in packages/create-next-app/templates/api/js/app/api/ to handle API routes with proper HTTP methods and response configurations.

Closes NEXT
Fixes #68256

@ijjk ijjk added the create-next-app Related to our CLI tool for quickly starting a new Next.js application. label Jul 29, 2024
@ijjk
Copy link
Member

ijjk commented Jul 29, 2024

Allow CI Workflow Run

  • approve CI run for commit: 5f3888f

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@devjiwonchoi
Copy link
Member

Hi @Tim-Zj! Could you push to #68130, not on another PR? Thank you!! 😄

@Tim-Zj
Copy link
Author

Tim-Zj commented Jul 29, 2024

@devjiwonchoi Sure, got it!

@Tim-Zj
Copy link
Author

Tim-Zj commented Jul 29, 2024

@devjiwonchoi I have merged the changes into the feat-headless-api branch,Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-next-app Related to our CLI tool for quickly starting a new Next.js application.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants