
Nuxt ngrok
使用 ngrok 轻松将您的 Nuxt 应用程序暴露到互联网。
功能
- 轻松集成:只需一行配置即可设置 ngrok。
设置
- 安装
@nuxtjs/ngrok
npx nuxi@latest module add ngrok
- 将
@nuxtjs/ngrok添加到nuxt.config.ts的modules部分
export default defineNuxtConfig({
modules: [
'@nuxtjs/ngrok',
],
ngrok: {
// module options
},
})
就是这样!您现在可以在 Nuxt 应用程序中使用 ngrok 了 ✨
对于 Nuxt 2 支持,请使用
@nuxtjs/[email protected]并遵循 v2.nuxtjs.org 上的说明。
选项
使用模块选项添加授权及更多功能
export default defineNuxtConfig({
modules: [
'@nuxtjs/ngrok',
],
ngrok: {
authtoken_from_env: true, // Use NGROK_AUTHTOKEN environment variable
// authtoken: 'your_ngrok_authtoken', // Or use this option
auth: 'username:password',
domain: 'your_custom_domain',
production: true,
},
})
了解更多关于模块选项的信息。
使用
现在,如果您运行 Nuxt 应用程序,您应该会在控制台中看到一条消息,显示 ngrok URL。
✔ Ngrok connected at https://your_ngrok_url
贡献
本地开发
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Release new version
npm run release