December 2020
🔨 Pokédex made with Svelte using Pokémon API.
From Udemy: Svelte de A à Z
Applcation that fetches a Pokémon API.
It displays Pokémons by name (in French) and display an image of the creature.
Tip: disable autosave when you work with api, otherwise it will make tons of not useful request.
npm install
npm run dev
npm install -D gh-pages
"scripts": {
"dev": "sapper dev",
"build": "sapper build --legacy",
"export": "sapper export --legacy",
"start": "node __sapper__/build",
"deploy": "sapper export --legacy && gh-pages -d __sapper__/export"
},
npm run deploy
heroku login
heroku create my-app
git push heroku HEAD:master
Use :
import { onMount } from 'svelte'
onMount(async () => {
const fetchPokemonBase = () => {
fetch('https://pokeapi.co/api/v2/pokemon/?limit=151')
// ...
});