netlify

netlify/next-on-netlify

Build and deploy Next.js applications with Server-Side Rendering on Netlify!

JavaScript
725
66
MIT License

`next-on-netlify` supports background functions, but only for SSR pages, not for API routes. Background functions are supported in [@netlify/plugin-nextjs](https://github.com/netlify/netlify-plugin-nextjs#background-functions). ### Using Netlify Identity If you are using Netlify Identity, you can use the `next-on-netlify-identity` package. This will automatically add the Netlify user object to your Next.js request object, so you can access the user object on the Next.js side: ```js // pages/api/auth.js export default (req, res) => { return res.status(200).json({ name: req.user.user_metadata.full_name, email: req.user.email, }); }; ``` ```js // pages/profile.js import { useEffect } from "react"; export default function Profile({ name, email }) { useEffect(() => { // fetch('/api/auth') // .then(res => res.json()) // .then(data => console.log(data)) }, []); return ( <div> <h1>Hello {name}!</h1> <p>Your email: {email}</p> </div> ); } export async function getServer

Total donated
Undistributed
Share with your subscribers: