-
Notifications
You must be signed in to change notification settings - Fork 27k
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
[with-typescript] Updated TypeScript example to use API routes #9073
Conversation
Next.js 9.0.0 has been out for a while, which supports API routes, but the examples were never updated to make use of it. This PR adds a simple example of an API route which also makes use of dynamic routing. A simple `fetch()` wrapper is also added for example purposes, and the pages structure have also been updated to dynamic routing.
Stats from current PRDefault Server ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Client Pages
Client Pages Modern
Client Build Manifests
Rendered Page Sizes
Serverless ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Client Pages
Client Pages Modern
Client Build Manifests
Serverless bundles
Commit: c8fdb91 |
Stats from current PRDefault Server ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Client Pages
Client Pages Modern
Client Build Manifests
Rendered Page Sizes
Serverless ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Client Pages
Client Pages Modern
Client Build Manifests
Serverless bundles
Commit: b704d1d |
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.
Hi @resir014 thank you for the PR, this changes introduces more complexity into the example but I do like it as a way of showing API types, which is the point of the example.
I updated the link for the dynamic route and it should be ready to go 👍
Thanks @lfades! Would you mind if I work on another PR splitting this example into two, one for the most basic TS example for a quickstart, and the other for TS + API routes? I can work on it sometime next week. |
@resir014 It's good right now, way better than having it separated, thank you 👍 |
Next.js 9.0.0 has been out for a while, which supports API routes, but
the examples were never updated to make use of it. This PR adds a simple
example of an API route which also makes use of dynamic routing.
A simple
fetch()
wrapper is also added for example purposes, and thepages structure have also been refactored to dynamic routing.