GithubHelp home page GithubHelp logo

benedyktt / gastrocalculator Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5.72 MB

Enter your favourite recipe and generate nutrition table.

Home Page: https://gastrocalculator.herokuapp.com/

License: MIT License

JavaScript 92.51% HTML 0.38% CSS 7.10%

gastrocalculator's Introduction

Build Status

This project is simple app that allows you to get nutrition table out of your favourite recipe. It uses jest for testing, react with redux in a front end, and custom styles with sass. User can add his recipe to database, and browse other users recipes as well

live project is available here:

Prerequisites

after cloning this project you need to install necessary dependencies of the server and client as well

npm run deps

Install dependencies for client and server

You also need 3 env variables in .env file to connect with API and with mongodb

APPLICATION_ID

APPLICATION_KEY

MONGO_URI

In the project directory, you can run:

npm run dev

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

This command will use concurrently to run server and client (server will be run on port 5000 )

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.

For testing endpoints I've used supertest

local database will be run for selected tests

Biggest issues on the way

  1. This structure is prepared to deploy client and server from on place (for example heroku) To not exceed project scope too much I decided to use create react app - which uses jest, because client has its own node_modules - using it main project triggered conflict. In order to fix it I needed to eject create-react-app, which allowed me to remove jest from client. More optimised way would to be to create webpack config manually.

Cool things about it

  1. It creates local database in test enviroment instead of making real db calls
  2. Have unit tests as well as integration tests of endpoints
  3. It works with cool API Edamam which uses language processing to recognize and calculate nutrition values
  4. State mangament is well organised, every action is dispatched trough function, not directly in component, so front end part is easy to scale

Sad things

Due to fast development process app has couple of drawbacks

  1. Names of variables could be improved
  2. Minimum amount of comments (I know, I am sorry)
  3. Frontend isn't well tested mostly because of issue with jest conflict described above, I skipped it simply because assigment is focused on backend
  4. main background image isn't lazy loaded and isn't sufficiently optimized

gastrocalculator's People

Contributors

benedyktt avatar

Watchers

James Cloos 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.