Find local news relevant to a constituency
A Python server built with Chalice, meant to run on AWS Lambda. A React frontend built with Next.js, deployed to AWS S3 and served with CloudFront.
You must have Python3 installed on a Unix-like system.
Then:
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
echo "BING_API_KEY=<our api key>" > .env
chalice local --port 5000
This will create a server at http://127.0.0.1:5000
http://127.0.0.1:5000/constituencies will return a sorted list of constituencies.
http://127.0.0.1:5000/search?constituency=<url-encoded constituency name>&topic=<searchTerm>
will return the news search results.
cd frontend
curl -fsSL https://bun.sh/install | bash
bun install
echo "NEXT_PUBLIC_BASE_URL=http://127.0.0.1:5000" > .env.development
echo "NEXT_PUBLIC_BASE_URL=<our api gateway url>" > .env.production
bun dev
This will create a site at http://127.0.0.1:3000 that you can test with.
You must have a ~/.aws/config
file set up as follows:
[default]
aws_access_key_id=<our access key>
aws_secret_access_key=<our secret key>
region=eu-west-2
Log into the AWS console to get the values for these keys.
Please only deploy code that is merged to the main
branch.
cd backend
source .venv/bin/activate
python deploy.py
You will need the AWS CLI installed.
From the frontend directory, run
bun run build
bun run deploy
The site is currently running at https://www.localnewsfinder.uk/