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/ngrok@2.0.0
并按照 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