Skip to content

Greenetwork/BLX_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BLX Backend

How to build via Docker

docker build . -t blx_backend

if docker fails to build because rust version is out of date replace:

RUN . $HOME/.cargo/env && rustup default nightly

with:

RUN . $HOME/.cargo/env && rustup update && rustup default nightly

How to run via Docker

make sure to replace postgres://databaseurl/database with the actual database credentials provided.

docker run --rm -e PG_POOL_SIZE=1 -e PG_URL=postgres://databaseurl/database -p 8000:8000 blx_backend

Endpoints

when accessed return .json

front end usage:

curl localhost:8000/apn/317053

returns = {
pub apn_chr: Option<String>,
pub apn: Option<i64>,
pub geometry: Option<String>,
pub object_id: Option<i64>,
pub agency_name: Option<String>,
pub agency_unique_id: Option<i64>,
pub dwr_revise: Option<String>,
pub region: Option<String>,
pub acres: Option<f64>,
pub county: Option<String>,
pub crop2016: Option<String>,
pub id: i32,
}

chain usage:

curl localhost:8000/apn/chain/317053

returns = {
pub apn: Option<i64>,
pub agency_name: Option<String>,
}

How is the project setup

  • Project uses Rocket, Postgres, and R2D2 crates.
  • Endpoint definitions are found in src/main.rs
  • Database access is found in src/db/mod.rs
  • Project is initialised in src/main.rs and
  • To add new endpoints, follow the format found in src/main.rs
  • To add more DB methods, follow the format found in src/db/mod.rs
  • To create model mappings, follow the format found in src/model/mod.rs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •