-
Notifications
You must be signed in to change notification settings - Fork 26.5k
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 --api Flag to Create Headless API App with create-next-app #68130
base: canary
Are you sure you want to change the base?
Conversation
Signed-off-by: Arindam Majumder <arindammajumder2020@gmail.com>
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
Co-authored-by: Mert Can Altin <mertgold60@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a few tests at test/integration/create-next-app
.
Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
I tried pushing to this but looks like I don't have access. @Arindam200 |
Sure, I'm giving you the access |
I've invited you, can you please accept that? |
@@ -0,0 +1,3 @@ | |||
# Rename this file to `.env.local` to use environment variables locally with `next dev` | |||
# https://nextjs.org/docs/app/building-your-application/configuring/environment-variables | |||
MY_HOST="example.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can likely remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other templates also share this file, should we still remove it?
x-ref: https://github.com/vercel/next.js/blob/canary/packages/create-next-app/templates/app/ts/.env.example
@devjiwonchoi Hi, I added some ts examples, please take time to review, thanks! |
@Tim-Zj Wow, great work! Will take time to review. Thank you! |
@Arindam200 Would you like to take a look at the changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I've added some query/feedbacks @devjiwonchoi . |
packages/create-next-app/templates/app-api/js/app/with-middleware.js
Outdated
Show resolved
Hide resolved
packages/create-next-app/templates/app-api/ts/app/with-middleware.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
This reverts commit e7ac0a4.
# Rename this file to `.env.local` to use environment variables locally with `next dev` | ||
# Add .env files to your .gitignore to prevent accidentally committing sensitive information. | ||
# https://nextjs.org/docs/app/building-your-application/configuring/environment-variables | ||
MY_HOST="example.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some feedbacks on the template @devjiwonchoi
- Can we have some tests on Next.js side first to make sure it works in dev and build mode first?
- When I look
[...not-found]/route.js
should not be required, and it's not working as expected when I test against the generated route with-middleware.js
looks a bit confused to me when there's nomiddleware.js
but also need to be applied for each route.- Can we merge the dynamic routes cases between the
pokemon/[number]
andmethods/[method]
?
What?
Added a new option for
create-next-app
to create a headless API app. This includes:--api
flag forcreate-next-app
to create a headless app.public/
,app/page.*
, etc.).@types/react
,react
, etc.).Why?
This feature allows users to initialize projects with headless API templates, making it easier to set up projects that require backend functionality without frontend components.
How?
--api
flag to thecreate-next-app
command.route.js
features with comments for user guidance.Closes #68118
Closes NEXT-3633
Closes NDX-120