Complete the code to import a server-only module in Next.js.
import db from '[1]';
Server-only modules are imported from server-specific paths like 'server/db' in Next.js.
Complete the code to export a server-only function in Next.js.
export async function [1]() {
// server logic here
}Server-only functions often fetch data or perform backend logic, so fetchData fits best.
Fix the error in importing a server-only module in Next.js.
import [1] from 'server/utils';
getServerSession is a server-only function, so it should be imported from a server module.
Fill both blanks to correctly import and use a server-only function in Next.js.
import [1] from 'server/auth'; export async function handler() { const session = await [2](); return session; }
useSession with server importsgetServerSession is the correct server-only function to import and call for session data.
Fill all three blanks to create a server-only API route handler in Next.js.
import [1] from 'server/db'; export async function [2](req) { const data = await [3](); return new Response(JSON.stringify(data)); }
getData is imported from the server database module, GET is the HTTP method handler, and getData fetches the data.