Skip to content

Commit

Permalink
chore(cli): remove Route Handlers from App Router templates (#49076)
Browse files Browse the repository at this point in the history
[Slack
thread](https://vercel.slack.com/archives/C04K237UHCP/p1682972426769409)

Closes NEXT-1077

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed May 2, 2023
1 parent ee48c66 commit b7d657f
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the

You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.

[http://localhost:3000/api/hello](http://localhost:3000/api/hello) is an endpoint that uses [Route Handlers](https://beta.nextjs.org/docs/routing/route-handlers). This endpoint can be edited in `app/api/hello/route.js`.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

[http://localhost:3000/api/hello](http://localhost:3000/api/hello) is an endpoint that uses [Route Handlers](https://beta.nextjs.org/docs/routing/route-handlers). This endpoint can be edited in `app/api/hello/route.ts`.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions packages/create-next-app/templates/app/js/README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the

You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.

[http://localhost:3000/api/hello](http://localhost:3000/api/hello) is an endpoint that uses [Route Handlers](https://beta.nextjs.org/docs/routing/route-handlers). This endpoint can be edited in `app/api/hello/route.js`.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions packages/create-next-app/templates/app/ts/README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

[http://localhost:3000/api/hello](http://localhost:3000/api/hello) is an endpoint that uses [Route Handlers](https://beta.nextjs.org/docs/routing/route-handlers). This endpoint can be edited in `app/api/hello/route.ts`.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More
Expand Down

This file was deleted.

10 changes: 1 addition & 9 deletions test/integration/create-next-app/lib/specification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,14 @@ export const projectSpecification: ProjectSpecification = {
js: {
deps: [],
devDeps: [],
files: [
'app/page.js',
'app/layout.js',
'app/api/hello/route.js',
'jsconfig.json',
],
files: ['app/page.js', 'app/layout.js', 'jsconfig.json'],
},
ts: {
deps: ['@types/node', '@types/react', '@types/react-dom', 'typescript'],
devDeps: [],
files: [
'app/page.tsx',
'app/layout.tsx',
'app/api/hello/route.ts',
'tsconfig.json',
'next-env.d.ts',
],
Expand All @@ -119,7 +113,6 @@ export const projectSpecification: ProjectSpecification = {
deps: ['autoprefixer', 'postcss', 'tailwindcss'],
devDeps: [],
files: [
'app/api/hello/route.js',
'app/layout.js',
'app/page.js',
'jsconfig.json',
Expand All @@ -139,7 +132,6 @@ export const projectSpecification: ProjectSpecification = {
],
devDeps: [],
files: [
'app/api/hello/route.ts',
'app/layout.tsx',
'app/page.tsx',
'next-env.d.ts',
Expand Down
8 changes: 3 additions & 5 deletions test/integration/create-next-app/templates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ const startsWithoutError = async (
expect(await res.text()).toContain('Get started by editing')
expect(res.status).toBe(200)

const apiRes = await fetchViaHTTP(appPort, '/api/hello')
if (usingAppDirectory) {
expect(await apiRes.text()).toEqual('Hello, Next.js!')
} else {
if (!usingAppDirectory) {
const apiRes = await fetchViaHTTP(appPort, '/api/hello')
expect(await apiRes.json()).toEqual({ name: 'John Doe' })
expect(apiRes.status).toBe(200)
}
expect(apiRes.status).toBe(200)
} finally {
await killApp(app)
}
Expand Down

0 comments on commit b7d657f

Please sign in to comment.