ngrok
@nuxtjs/ngrok

ngrok 將您的本地主機暴露給全世界,方便測試和分享!無需處理 DNS 或部署,即可讓其他人測試您的更改。

@nuxtjs/ngrok

Nuxt ngrok

npm versionnpm downloadsLicenseNuxt

使用 ngrok 輕鬆將您的 Nuxt 應用程式暴露到網際網路。

功能

  • 輕鬆整合:只需一行配置即可設定 ngrok。

設定

  1. 安裝 @nuxtjs/ngrok
npx nuxi@latest module add ngrok
  1. @nuxtjs/ngrok 新增到 nuxt.config.tsmodules 部分
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