Coder Social home page Coder Social logo

carbtographer's Introduction

Carbtographer

Application that recommends macro friendly meals from local restaurants.

Netlify Status

Build Status CodeFactor Go Report Card Coverage Status

Frontend Link: https://carbtographer.com

Backend Link: https://api.carbtographer.com

NOTICE

Recently ported Node.js backend to a Golang backend.

Node.js back end on node-backend branch here.

Frontend

Frontend built in React.js, Redux and Styled Components

Enviroment Variables

You will require a Mapbox Access Token to make authenticated requests.

You can generate one following the intructions here: Mapbox: Access tokens

  • REACT_APP_MAP_BOX_KEY - your Mapbox Access Token (API Key)
  • REACT_APP_BACKEND_URL - your backend link

Usage

With all enviroment variables in place you can now run it locally

CD into client

cd client

Install node modules

npm i

Run

npm run start

Backend

Enviroment Variables

You will require a Yelp API Key to make authenticated requests. Locally ran Postgress and Redis server to test locally

You can generate one following the intructions here: Creating an app on Yelp's Developers site

  • PORT- your server PORT
  • YELP_API - your Yelp Key (API Key)
  • DB_HOST - your database Host URL
  • DB_PORT- your database PORT
  • DB_USER - your database user
  • DB_NAME - your database name
  • DB_PASSWORD - your database password
  • ENVIROMENT - must be PRO or DEV
  • JWT_KEY - jwt secret key
  • CACHE_ADDRS - redis server address
  • CACHE_PASSWORD - redis server password
  • CACHE_DB - redis databse number

Run locally

Enable go modules

export GO111MODULE=on

Scrape Info

go run main.go -scrape

Run migrations

go run main.go -migrate

Run Postgress seeds

go run main.go -seed

Run Redis seeds

go run main.go -seed-cache

Run server

go run main.go -serve


ENDPOINTS

GET /

{
    status: 200,
    message: "server live on port: ####"
}

GET /names

Returns all restaurant names in database

[
    {
        id: 1
        name: "Name"
    }
]

GET /locations/{lat}/{lon}

Returns restaurant info based on lat and long

lat: latitude
lon: longitude

[
  {
    "id": "id",
    "name": "Name",
    "coordinates": {
      "latitude": 0.0,
      "longitude": 0.0
    },
    "photos": [
      "url"
    ],
    "distance": 20.0
  }
]

GET /items/{id}

Returns all items for any given restaurant ID

id: restaurant ID

[
    {
        "id": 0,
        "name": "item name",
        "type": "type",
        "protein": 0,
        "carbs": 0,
        "fats": 0,
        "calories": 0,
        "calperpro": 0.0
        "sodium": 0,
        "r_id": 0
    }
]

GET /*

404 Endpoint

{
    status: 404,
    message: "route not found"
}

carbtographer's People

Contributors

reynld avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.