staging-nuxt
v0.0.4
Published
Nuxt module for staging password protection
Downloads
163
Readme
staging-nuxt
Nuxt.js integration for staging password protection middleware.
Live Demo
Try out our Nuxt.js demo (password: demo
):
⚡️ staging-nuxt.vercel.app
Installation
npm install staging-nuxt
# or
yarn add staging-nuxt
# or
pnpm add staging-nuxt
Usage
Create a server middleware file in your Nuxt.js project:
// server/middleware/staging.ts
import staging from 'staging-nuxt';
export default staging({
password: process.env.STAGING_PASSWORD,
siteName: "My Protected Site"
});
Features
- Native Nuxt.js middleware integration
- Built-in H3 support
- Cookie-based session handling
- Nitro compatibility
Configuration
See the main documentation for base options.
Default Configuration
The middleware comes with Nuxt-specific defaults:
const defaultOptions = {
siteName: "Protected Nuxt Page",
publicRoutes: [
"/_nuxt/*",
"/api/_content/*",
"/__nuxt_error",
"/favicon.ico",
"/assets/*",
"/_ipx/*",
]
};
You can add additional public or protected routes while keeping these defaults:
export default staging({
password: process.env.STAGING_PASSWORD,
publicRoutes: [
"^/public(/.*)?$",
"^/api/public(/.*)?$"
] // These will be merged with default public routes
});
Example
A complete working example is available in our repository: