
使用 ngrok 轻松将您的 Nuxt 应用程序暴露到互联网。
@nuxtjs/ngroknpx 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