matty-r / unsplash_actix_react

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

Simple Actix (backend) and React (frontend) "proxy" for Unsplash, rather than the frontend directly querying Unsplash, the query will go to the backend, and it will return the results to the frontend. This was put together to supplement my learning of the "Modern React with Redux" Udemy course (LINK), when building the Pics app.

untitled.mp4

Prerequisites

Setup

Go into frontend directory, install the required npm stuffs

  1. cd frontend
  2. npm install --save-dev react-scripts

Get an API key from Unsplash and place it into frontend/src/config/config.json

  1. cd src/config
  2. nano config.json .. "UNSPLASH_API_KEY"

Return to frontend root, Build the frontend

  1. cd ../..
  2. npm run build

Head back to the root directory, and run the backend

  1. cd ../

  2. cargo run

  3. From your browser on your local machine, navigate to localhost:8081, and run a search.

  4. Or, make a curl request against the running server from your terminal:

curl "http://localhost:8081/img?query=cars" -H "Authorization: Client-ID putyour-api-keyhere"

About


Languages

Language:Rust 38.0%Language:JavaScript 36.4%Language:HTML 23.3%Language:CSS 2.2%