SvelteKit + Axios
HTTP client with a preconfigured base URL. This page shows exactly what pickstack adds to a SvelteKit project for Axios: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework sveltekit --modules axios --yesCustomize in the configurator
Packages it adds
| Package | Version | Type |
|---|---|---|
axios | ^1.21.1 | runtime |
New files
VITE_API_URL=http://localhost:3000
import axios from "axios";
export const api = axios.create({
baseURL: import.meta.env.VITE_API_URL ?? "http://localhost:3000",
timeout: 10_000,
});
Changes to existing files
<section class="page"> <h1 class="title">About</h1>+ <p class="text">Built with SvelteKit, Svelte 5, TypeScript, Axios.</p>− <p class="text">Built with SvelteKit, Svelte 5, TypeScript.</p> </section>
Project files
.env.example.gitignoreREADME.mdpackage.jsonsrc/api/client.tssrc/app.d.tssrc/app.htmlsrc/lib/Counter.sveltesrc/lib/index.tssrc/routes/+layout.sveltesrc/routes/+layout.tssrc/routes/+page.sveltesrc/routes/about/+page.sveltesrc/routes/layout.cssstatic/robots.txttsconfig.jsonvite.config.ts