Giter Site home page Giter Site logo

legodi-2.0's Introduction

LEGODI 2.0

APP

  1. Fork and Clone the repo.
  2. Make sure you go inside the app folder and then yarn or npm install.
  3. To run it use: yarn start / npm start

Server

-To run the server, make sure you have strapi installed npm install strapi@alpha -g then strapi start from the server folder

Infrastructure

staging and production environments are hosted in the CYF kubernetes cluster ( https://github.com/CodeYourFuture/kubernetes).

The endpoints are:

https://api.legodi.codeyourfuture.io

https://api.staging.legodi.codeyourfuture.io

All the automation configuration can be found in .circleci/config.yml. Feel free to change and adapt to your needs (ex.: run tests before deployment, etc).

The container images are stored in docker hub under the codeyourfuture repository:

https://hub.docker.com/r/codeyourfuture/legodi-api

What is docker-compose file do

It includes postgreSQL database image so if you do not have postgreSQL installed locally this file will create one for you.

How to use docker-compose file

To use this file you need first to install docker then go to main directory of legodi then run: docker-compose up for more details go to https://docs.docker.com/compose/overview

Linting

StandardJs has been setup as a linter in both app and server. To run it use npm run lint to run it with automatic fixing use this command npm run lint -- --fix

Commitzen

git commitzen has setup as a git commit in both app and server. Instead of using git commit you should use git cz When you commit with Commitizen, you'll be prompted to fill out any required commit fields at commit time. No more waiting until later for a git commit hook to run and reject your commit (though that can still be helpful). No more digging through CONTRIBUTING.md to find what the preferred format is. Get instant feedback on your commit message formatting and be prompted for required fields.

Testing

To run all the test use the command npm test

to run a specific test npm test theNameOfTheFile for example npm test mock-api

APP navigation

we've update the navigation function, we've created a helper file to reduce and simplify the code currentley there is two functions inside helper

1-GenerateNavigation GenerateNavigation function created to reduce the code in MainTabNavigator and make it easy to use and unerstand GenerateNavigation takes 5 parameters we can update it take more or less parameters

const generateNavigation = (routeStack, label, color, iosIcon, androidIcon) => {
  routeStack.navigationOptions = {
    tabBarLabel: label,
    tabBarIcon: ({ focused }) => (
      <TabBarIcon
        focused={focused}
        color={color}
        name={
          Platform.OS === 'ios'
            ? `${iosIcon}${focused ? '' : '-outline'}`
            : androidIcon
        }
      />
    ),
  };
};

2- tabBarVisibility We've created this function to hide the footer (tabBarVisibility) when we open Articles and Article page. We can update this function to hide the footer from another screens just by the screen route name to the condition.

Control tab bar visibility at different screens

export const tabBarVisibility = navigation => {
  let initialValue = true;
  navigation.state.routes.map(route => {
    const { routeName } = route;
    if (routeName === 'Article' || routeName === 'Articles') {
      return (initialValue = false);
    }
  });
  !initialValue ? { tabBarVisible: false } : null;
};

Database

The first time you create the database, you will need to run these commands (three of them separately) in postgres

DROP ROLE IF EXISTS cyf;
CREATE USER cyf WITH PASSWORD 'password';
CREATE DATABASE legodi OWNER cyf;

Migrations

We use knex for migrations, but we created alias helpers on package.json to make it easier to run the commands.

knex

  1. Create a migration npm run create-migration table_name
  2. Create a seed npm run create-seed table_name
  3. To

legodi-2.0's People

Contributors

khaledkz avatar islam95 avatar dwinatech avatar khaledkzy avatar pedroguima avatar kabaros 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.