Astro + Axios
HTTP client with a preconfigured base URL. This page shows exactly what pickstack adds to a Astro 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 astro --modules axios --yesCustomize in the configurator
Packages it adds
| Package | Version | Type |
|---|---|---|
axios | ^1.21.1 | runtime |
New files
PUBLIC_API_URL=http://localhost:3000
import axios from "axios";
export const api = axios.create({
baseURL: import.meta.env.PUBLIC_API_URL ?? "http://localhost:3000",
timeout: 10_000,
});
Changes to existing files
⋯ 4 unchanged lines <Layout title="About"> <section class="page"> <h1 class="title">About</h1>+ <p class="text">Built with Astro, TypeScript, Axios.</p>− <p class="text">Built with Astro, TypeScript.</p> </section> </Layout>
Project files
.env.example.gitignoreREADME.mdastro.config.mjspackage.jsonsrc/api/client.tssrc/components/Counter.astrosrc/layouts/Layout.astrosrc/pages/about.astrosrc/pages/index.astrosrc/styles/global.csstsconfig.json