This is a boilerplate for svelte(-kit) and koa. It includes:
npx degit kaladivo/svelte-kit-koa-boilerplate my-new-super-cool-project
src/server
- Where the Koa server lives insrc/server/createServer.ts
- Creates Koa server, here you can add more routessrc/app
- SvelteKit app directory. See official docs to find out more.
First of all, run yarn install
to install all dependencies.
If you with to modify env vars, copy .env.example into .env and modify the contents to your liking.
yarn start:server
- starts koa dev serveryarn start:app
- starts svelte-kit dev serveryarn start
- runs both start commands concurrently
When developing the app, make sure to access Koa server (with the correct port) not the svelte dev server. Koa service is configured to automatically proxy requests to svelte server. This way we do not have to deal with CORS
yarn build:server
- builds Koa server into /build folderyarn build:app
- builds Svelte-kit app into /build folderyarn build
- runs both build commands concurrently
yarn serve
- Starts built koa server
(!) Unresolved dependencies
when running build:sever Error: connect ECONNREFUSED 127.0.0.1:80
- when requesting page