This is a simple Express app hosted on an Amazon Linux 2 EC2 server used by peterwalker.xyz/bookapp to query Google Books Api.
peterwalker.xyz/bookapp fetches this api key by calling https://api.peterwalker.xyz/api/key.
This is important because Single Page Applications expose any secrets they are built with.
I use certbot to create the https certifications
sudo yum install -y certbot
sudo certbot certonly --standalone -d api.peterwalker.xyz
I run this process in the background of my EC2 server using
sudo pm2 start server.js
- Get an API key for the Google Books API here
- Set it in .env export API_KEY=
- npm install
- NODE_ENV=development npm start
- Now this server is running on port 3001 http://localhost:3001
- Set up local dev for the bookapp here