Code Monkey home page Code Monkey logo

food-truck-app's Introduction

Food Truck App (Django, Reactjs and Docker)

How to run the application.

Backend

Step 1:

  • Clone the application to your local machine
  • In the root of the application go to the /backend folder.

Step 2:

  • Create a .env file within the /backend folder and add the following content:
POSTGRES_DB=rackt_project_db
POSTGRES_USER=rackt_project_user
POSTGRES_PASSWORD=rackt_project_password
SECRET_KEY=mysecretkey123

Step 3:

Add the following command to make the application run:

docker-compose up --build

Step 4: Go to the following path to access the backend:
http://localhost:8000/api/food-trucks/

Different query params you can use:

To return different objects based on cuisine:
http://localhost:8000/api/food-trucks/?cuisine=mexican

To return different objects based on latitude, longitude and radius:
http://localhost:8000/api/food-trucks/?latitude=37.760086931986980&longitude=-122.418806481101140&radius=2


Run backend CLI commands:

Populate FoodTruckInfo model from csv: python manage.py populate_food_trucks food-truck-data.csv

Delete all data from a specific model: python manage.py delete_all_data <model_name>

Retrieve nearby trucks (information): python manage.py retrieve_nearby_trucks <latitude> <longitude> <radius>

Ex:

root@c99745dd6dd3:/app# python manage.py retrieve_nearby_trucks 37.760086931986980 -122.418806481101140 0.3
Nearby Food Trucks:
Name: Leo's Hot Dogs | Distance: 0.0 miles
Name: Natan's Catering | Distance: 0.22737891713614777 miles
Name: Julie's Hot Dogs | Distance: 0.2132391777781961 miles
Name: SOHOMEI, LLC | Distance: 0.17579350137205169 miles
Name: Julie's Hot Dogs | Distance: 0.06013131646801611 miles
Name: Julie's Hot Dogs | Distance: 0.08895032693756173 miles

Run tests: `python manage.py test`

Ex:

..........
----------------------------------------------------------------------
Ran 10 tests in 1.880s

OK
Destroying test database for alias 'default'...

Frontend


Run the application:

Step 1:

  • In the root of the application go to the /backend folder.
  • npm install
  • docker-compose up --build
  • Go to localhost:3000

If in windows:
  • npm install
  • npm start
  • Go to localhost:3000

What sould appear: image.png

image.png

Rationale

What I would do if I had more time:

  • Add more inputs with different queries in the frontend.
  • Display each truck in different cards and its info with a button to check its location.
  • In the frontend I would create separation of concerns with a directory with their own responsabilities.
  • Would improve the frontend dockerization.

food-truck-app's People

Contributors

eliasoprado avatar tanishqandmac avatar

Watchers

 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.