Note: To make content changes go straight to Edit content
To ensure the server works correctly you will need to add service account key in the root directory.
Add a file in the /api
directory named .env
. Then follow these steps
- Vist google cloud platform landing page
- Open the sidebar and then click
APIs & Services
>Credentials
- Under
Service Accounts
click the row with the name ofStorage admin -bq
- Click
Create key
- Copy the private key and client email of this json file into the
.env
file you created earlier. Like so:
PRIVATE_KEY=[insert private key here]
CLIENT_EMAIL=[insert client email here]
Redis is used to cache requests from google cloud storage. This helps retrieve data quicker and reduces the amount of requests made to google cloud storage. Download redis from the doc site. Mac users may run brew install redis
.
First start the redis server on port 6379
$ redis-server --port 6379
Optional: once the server has started, you can use the redis-cli in another terminal window.
$ redis-cli -p 6379
Once this is done run the following commands from the /api
directory to start the server:
$ npm i
$ npm run dev
It will start on port 3000 by default.
The api/gc-config.js
file contains paths to cloud storage locations of the buckets and files that are being referenced.
The api/src/schema.js
file contains custom graphQL data structures for the queries.
Once in the observatory-front-end
directory run the following commands:
$ export GATSBY_API_URL="http://localhost:3000/api"
$ npm i
$ npm run start
All content can be found in the observatory-front-end/content
folder. It is contained in markdown files. View the markdown cheatsheet for more information.
New pages can be with markdown files. For example to create a contact page, follow these steps:
- In the
front-end/content
folder, create a new folder calledcontact-us
. - In the
front-end/content/contact-us
folder, create a new file named contact.md - Add the following content to the page
---
path: /contact
title: Contact Us
createPage: true
---
# Contact the team
To get into contact with the team, please email at abc@example.com
The path
attribute is the URL and the title
attribute is for the title of the page.
To add links to new pages in the main nav bar or the footer, follow these steps:
- Open up the
front-end/gatsby-config.js
file. - Find the
menuLinks
key for main nav links and thefooterLinks
key for the footer items. - If you want to add a main nav link to the contact page we created above, add an object to the
menuLinks
key.
menuLinks: [
{
text: "Home",
link: "/",
},
{
text: "About",
link: "/about",
},
]
menuLinks: [
{
text: "Home",
link: "/",
},
{
text: "About",
link: "/about",
},
{
text: "Contact",
link: "/contact",
},
],
The footer links can be updated in a similar way using the footerLinks
key in the front-end/gatsby-config.js
file.