透過超過 100 個訣竅來學習 Nuxt!

ngrok
@nuxtjs/ngrok

ngrok 將您的 localhost 公開給全世界,方便測試和分享!無需為了讓其他人測試您的更改而搞 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/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