Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from haydn/add-support-for-server-side-props
Add a HOF for wrapping getServerSideProps handlers
- Loading branch information
Showing
6 changed files
with
126 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { withAxiomGetServerSideProps } from 'next-axiom'; | ||
|
||
export const getServerSideProps = withAxiomGetServerSideProps(async ({ req, log }) => { | ||
log.info('Hello from server side'); | ||
return { | ||
props: { | ||
method: req.method, | ||
}, | ||
}; | ||
}); | ||
|
||
export default function Home({ method }: { method: string }) { | ||
return ( | ||
<div> | ||
<h1>Hello from server, this is a {method} request</h1> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
export { reportWebVitals } from './webVitals'; | ||
export { log, Logger } from './logger'; | ||
export { withAxiom, AxiomAPIRequest, AxiomRequest } from './withAxiom'; | ||
export { | ||
withAxiom, | ||
withAxiomGetServerSideProps, | ||
AxiomAPIRequest, | ||
AxiomRequest, | ||
AxiomGetServerSideProps, | ||
AxiomApiHandler, | ||
AxiomMiddleware, | ||
AxiomGetServerSidePropsContext, | ||
} from './withAxiom'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0b17e82
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.
Successfully deployed to the following URLs:
next-axiom-example – ./
next-axiom-example-lemon.vercel.app
next-axiom-example.axiom.dev
next-axiom-example-git-main.axiom.dev