Snelle referentie

Divshot Statische Hosting CLI Spiekbriefje

Historische referentiegids voor Divshot statische webhosting: divshot.json-configuratie, routeringsregels, schone URL’s, CLI-commando’s en doorverwijzingen.

· Gepubliceerd

[!NOTE] Divshot was een vroege hostingplatform voor statische webapplicaties dat in 2015 door Google Firebase werd overgenomen. Deze gids dient als historische referentie voor de declaratieve routeringspecificatie.

CLI-Werkstroom

# Installeer de CLI en log in
npm install -g divshot-cli
divshot login

# Maak een project aan en start de lokale server
divshot init
divshot server

# Deploy naar specifieke omgevingen
divshot push development
divshot push staging
divshot push production

# Promoveer builds tussen omgevingen
divshot promote staging production

Configuratie (divshot.json)

{
  "name": "my-static-app",
  "root": "./dist",
  "clean_urls": true,
  "error_page": "404.html",
  "routes": {
    "/*.html": "index.html",
    "/app/**": "app.html",
    "**": "index.html"
  },
  "redirects": {
    "/old-docs/:page": "/new-docs/:page",
    "/blog/rss": {
      "status": 301,
      "url": "https://feeds.example.com/rss"
    }
  },
  "headers": {
    "/assets/**": {
      "Cache-Control": "max-age=31536000"
    },
    "/api/**": {
      "Access-Control-Allow-Origin": "*"
    }
  }
}

Omgevingsvariabelen & Aangepaste Domeinen

# Omgevingsvariabelen toevoegen
divshot env:add production API_KEY=xyz
divshot env:pull production

# Aangepast domein toevoegen
divshot domains:add www.example.com

# Staging-omgevingen beveiligen met een wachtwoord
divshot protect staging "tester:secretpass"

Verwante onderwerpen