* API routes examples and documentation
* Update examples/api-routes-micro/README.md
Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>
* Update examples/api-routes/README.md
Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>
* Apply suggestions from code review
Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>
* Update API routes docs
* Improve example to reflect dynamic routes
* Update readme to reflect API routes changes
* Apply suggestions from review
* Change static method handling and pages revert
* Allow and reflect old behaviour
* Post should return 501
* Add back old test
* Invert logic
* Handle 501 for pages in separate location
* Remove usage of 501 HTTP status code
* Prevent information leak
* Add test
* Only 405 if the page exists -- 404 if it doesn't
* Handle sent responses
* Revert "Handle sent responses"
This reverts commit 5e9012ae29b611c25ed1e090756a25dbe3437182.
* Fix bad test
* Switch back to quiet
* Update test/integration/production/test/index.test.js
Co-Authored-By: JJ Kasper <jj@jjsweb.site>
* Add initial static indicator
* Update indicator text to pre-rendered
* Update naming from static to prerender
* Update to not re-use nextExport var
* Update positioning of indicator to prevent overlap
* Added basic example for dynamic routing
* Added some basic docs for dynamic routing
* Added more docs for dynamic routing
* Used doctoc
* fixed lint issues
* Added useRouter to docs
* Removed getInitialProps examples that are only using router props
* Added useRouter to the navigation
* Small fix
* Updated to the latest dynamic routes implementation
* lint fix
* Update dynamic routing example
* Tweak dynamic routing documentation
* Make basic example basic again
* Adjust dynamic routes section
* Remove query param for dynamic routes example
* Remove old note
* Fix linting
* Add prerender PageConfig option
* Update PageConfig type
* Add inlining of data when pre-render is set and add tests
* Update types import
* Add check for props
* Rename prerender to experimentalPrerender for now
Using runtime configuration can cause you to de-optimize entire classes of optimizations.
These optimizations could make your application an order of magnitude faster (i.e. prerendering).
The second line of this comment was removed in the previous commit due to the usage of process.browser.
This meant the comment was incomplete and confusing
c03e94bebd (diff-a15b49cbb3a523d81a74e0fab7f08eb5)
* Remove `withAmp` and do not expose `isInAmpMode`
This pull request removes the `withAmp` higher-order component in favor of the exported configuration object.
Retaining this backwards compatibility isn't worth the extra maintenance burden, given it hasn't been released for very long and the migration is ultra-simple.
I'm 👎 on retaining backwards compatibility just for the sake of it.
Migration example follows. I'm willing to write a codemod if reviewers feel it's necessary.
*Before*
```js
import { withAmp } from 'next/amp'
function Home() {
return <h1>My AMP Page</h1>
}
export default withAmp(Home)
// or
export default withAmp(Home, { hybrid: true })
```
*After*
```js
export default function Home() {
return <h1>My AMP Page</h1>
}
export const config = {
amp: true,
// or
amp: 'hybrid',
}
```
* Fix { amp: 'hybrid' }
Co-Authored-By: JJ Kasper <jj@jjsweb.site>