Q91. Prevent API routes from being accessed by the client?
To prevent API routes from being accessed by the client, you can implement authentication and authorization checks in your API route handlers. This ensures that only auth...
Technical Question Bank · Peer-Reviewed
Search and filter frequently asked interview questions across technical, programming, and behavioral domains. Tailor your interview preparation by difficulty for freshers or experienced developers (188 available).
To prevent API routes from being accessed by the client, you can implement authentication and authorization checks in your API route handlers. This ensures that only auth...
JSON Web Tokens (JWT) can be used in Next.js for authentication and authorization. You can create a JWT token upon user login and store it in a cookie or local storage. T...
By creating a `globals.css` file in the `app` directory and importing it in the `_app.js` file. ```css /* app/globals.css */ body { margin: 0; font-family: -apple-system,...
You can opt into the Edge Runtime to run API routes on the V8/edge environment. Add `export const runtime = "edge";` at the top of a route handler and use the Web `Reques...
Use `placeholder="blur"` with a `blurDataURL` or let Next.js generate it when importing static images. This shows a low-quality blurred preview while the image loads. ```...
In the App Router you can control revalidation when fetching data by passing the `next` option to `fetch`. For example, to revalidate every 10 seconds: ```js const res = ...
Only expose non-sensitive variables by prefixing them with `NEXT_PUBLIC_`. Keep secrets (API keys, DB credentials) server-only in `.env` and access them from server-side ...
For basic protection you can use an in-memory store (suitable for single-instance apps) or a shared store (Redis) for multiple instances. Example memory-based limiter usi...
The Pages Router is a file-based routing system in Next.js that automatically creates routes based on the file structure inside the `pages` directory.
In Next.js pages router, you create routes by adding files to the `pages` directory: - `pages/index.js` - the homepage (/) - `pages/about.js` - the about page (/about) - ...
HireXTech uses essential storage to remember your study preferences and third-party advertising cookies via Google AdSense in compliance with GDPR. You can choose to enable essential cookies only or accept all cookies. Read our Privacy Policy.