पाठ 19 / 25
Hosting, App Hosting and Preview Channels
Deploying web apps.
Two hosting products
Firebase Hosting serves static assets and single-page apps from a global CDN with HTTPS, custom domains, redirects and rewrites (including rewrites to Cloud Functions or Cloud Run for dynamic routes). Configuration lives in firebase.json. Preview channels deploy a build to a temporary URL that expires, ideal for pull-request previews. Firebase App Hosting is aimed at server-rendered frameworks such as Next.js and Angular: it connects to a GitHub repository and builds and rolls out on push. Framework support and features differ between the two and change over time, so check the docs.
Ship it and keep users engaged
Hosting serves your web app; Messaging, Remote Config, Analytics and Crashlytics help you operate it.
Config and CLI commands
firebase.json and Firebase CLI (shown, not run).
# firebase.json (excerpt)
# {
# "hosting": {
# "public": "dist/app/browser",
# "ignore": ["firebase.json", "**/.*"],
# "rewrites": [{ "source": "**", "destination": "/index.html" }]
# }
# }
firebase login
firebase init hosting
npm run build
firebase deploy --only hosting
# temporary preview URL for a branch or pull request
firebase hosting:channel:deploy pr-42 --expires 7dPreview every pull request
Wire preview channels into CI so reviewers can open a live URL for each change before it reaches production.
त्वरित जाँच: What is a Hosting preview channel?
- A push notification topic
- A second Firestore database
- A Remote Config parameter
- A temporary URL for a build that can expire automatically
Answer
A temporary URL for a build that can expire automatically — Previews separate review from production.