/svelte-ssr-example

A Svelte 3 server side render example, with hashed JS and CSS chunks

Primary LanguageJavaScriptMIT LicenseMIT

Svelte SSR Example with Code Split

A Svelte 3 server side render example, with hashed JS and CSS chunks, using rollup and rollup-plugin-css-chunks.

Installation

git clone https://github.com/domingues/svelte-ssr-example.git
cd svelte-ssr-example
npm install

Usage

npm run build
npm run start

or

npm run start:dev

and open your browser

curl http://localhost:3000/

you can pass props in the url

curl http://localhost:3000/?props={%22size%22:64}

or submit it a POST request

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"size":64}' \
  http://localhost:3000/

Environment variables

Build time

  • $PUBLIC_STATIC_PATH: path where the static files will be located, local like /static or a remote CDN like //abc.mycdn/project;

Runtime

  • $NODE_HOST
  • $NODE_PORT

License

MIT