From f67f38866fd6e2120d7d93f7623aa176c9929955 Mon Sep 17 00:00:00 2001 From: Nicolai Rosdahl Tellefsen Date: Sun, 22 Sep 2024 17:16:04 +0200 Subject: [PATCH 1/2] docs: add minimal setup instructions --- .gitignore | 1 + DEVELOPMENT.md | 35 +++++++++++++++++++++++++++++++++++ README.md | 4 ++++ 3 files changed, 40 insertions(+) create mode 100644 DEVELOPMENT.md diff --git a/.gitignore b/.gitignore index 1db770a..80467ce 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ pnpm-debug.log* # environment variables .env .env.production +.env*.local # macOS-specific files .DS_Store diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..b20e0f0 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,35 @@ +# Basic development setup + +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](https://github.com/gathering/tgno-backend). + +## Getting started + +(If you don't have pnpm installed, you can install it with `npm install -g pnpm`) + +1. Clone this repo +2. Run `pnpm install` +3. Run `pnpm dev` +4. Frontend should now be available on `localhost:4321` serving content from `https://dev.tg.no` + +## Using local backend + +Same procedure as above, but with a few extra steps: +1. Make sure local backend is running and available on a local port +2. Create a `.env.development.local` file in the root of the project (not `.env.local` due to how Astro prioritizes env files) +3. Add the following line to the file: `API_URL=http://localhost:3000` (make sure the port matches the port of your local backend) + +## Common issues + +### Data is still loading from dev.tg.no + +* Try restarting the dev server +* Make sure you have created the `.env.development.local` file and added the correct `API_URL` to it +* Make sure there are no invalid formatting in env file + +### No content is loading when using local backend + +* Make sure the backend is running and available on the correct port (try opening `API_URL` 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 diff --git a/README.md b/README.md index 259f204..5f3b2fb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +# Getting started + +See [DEVELOPMENT.md](DEVELOPMENT.md) for more detailed instructions on how to get local development setup up and running. PRs on any part of documentation is very welcome! + # Astro Starter Kit: Basics ```sh From b3e374fced6b823b5993f17eb4f80d5f65a33365 Mon Sep 17 00:00:00 2001 From: Nicolai Rosdahl Tellefsen Date: Sun, 22 Sep 2024 20:59:50 +0200 Subject: [PATCH 2/2] fix: use default port and paths --- DEVELOPMENT.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index b20e0f0..52022fa 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -18,7 +18,7 @@ For basic installation of backend repo see [backend repo](https://github.com/gat Same procedure as above, but with a few extra steps: 1. Make sure local backend is running and available on a local port 2. Create a `.env.development.local` file in the root of the project (not `.env.local` due to how Astro prioritizes env files) -3. Add the following line to the file: `API_URL=http://localhost:3000` (make sure the port matches the port of your local backend) +3. Add the following line to the file: `API_URL=http://localhost:8000` (make sure the port matches the port of your local backend) ## Common issues @@ -30,6 +30,7 @@ Same procedure as above, but with a few extra steps: ### No content is loading when using local backend -* Make sure the backend is running and available on the correct port (try opening `API_URL` in browser) +* 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 +