This repo by default connects to live dev environment on https://dev.tg.no
which makes it easy to get started. For more advanced tasks, such as working on content types not yet released, you should instead use local backend instance.
For basic installation of backend repo see backend repo.
(If you don't have pnpm installed, you can install it with npm install -g pnpm
)
- Clone this repo
- Make sure you have the correct node version installed (
nvm use
thennvm install
) - Run
pnpm install
- Run
pnpm prepare
# Setup Husky for pre-commit - Run
pnpm dev
- Frontend should now be available on
localhost:4321
serving content fromhttps://dev.tg.no
We use husky pre-commit for making sure all code conforms to the same formatting. This happens automatically on commit after this first time setup, if it doesn't work try a fresh pnpm install
Same procedure as above, but with a few extra steps:
- Make sure local backend is running and available on a local port
- Create a
.env.development.local
file in the root of the project (not.env.local
due to how Astro prioritizes env files) - Add the following line to the file:
API_URL=http://localhost:8000/
(make sure the port matches the port of your local backend)
Identical to using local backend section above, but use https://www.tg.no/
instead of http://localhost:8000/
- Try restarting the dev server
- Make sure you have created the
.env.development.local
file and added the correctAPI_URL
to it - Make sure there are no invalid formatting in env file
- Make sure the backend is running and available on the correct port (try opening
API_URL
+/api/v2/news/
in browser) - If backend is running in docker, make sure the port is exposed in the docker-compose file
- Check that backend data has been properly seeded. On first startup it might be in a broken state until initiall setup steps have been done. See backend repo for details