Skip to content

Latest commit

 

History

History
147 lines (90 loc) · 5.11 KB

README.md

File metadata and controls

147 lines (90 loc) · 5.11 KB

K-App

K-App application repository

license David David Travis Codecov branch

Introduction

This repo contains the application used to manage the association.

It is written in javascript (back) and typescript (front). It uses these frameworks:

And we use MySQL and MongoDB as databases.

Usage

For a production environment, please check this document which explain everything :).


Developing - No Docker

To contribute to the project you will need:

  • NodeJS version 10.0.x or higher.
  • Yarn version 1.9.0 or higher.
  • MySQL version 5.7 or higher. Please note that your MYSQL server must be configured as case insensitive in order to perform migration scripts (how to)
  • MongoDB version 4.0 or higher.
  • Python 3 latest version.
  • Git. For windows, for linux : sudo apt-get install git

After installing NodeJS, you have to install node-gyp as recommended here.

Optional:

Clone the repo with git clone https://github.com/K-Fet/K-App.git.

Then, run yarn.

CLI

The application comes with a small cli which provide multiple actions. Some of them are used only in production, others are used only in development.

Configuration

.env

To configure your environment, copy /tools/config-samples/.env.example to /.env. Then you just have to edit field as you want (cp tools/config-samples/.env.example .env).

P.S.: The file .env is already ignored by git.

proxy.conf.json

As the project could be used in two different dev env, we need two different configurations for the proxy of the front.

Here, we want to use the docker configuration. So just copy the local.proxy.conf.json file using: cp local.proxy.conf.json proxy.conf.json

P.S.: The file proxy.conf.json is already ignored by git.

Environment variables

Environment variables are parsed with nconf. The separator used is __ and words are transformed into camelCase.

E.g.: WEB__JWT_SECRET will be access with conf.get('web:jwtSecret').

Launch server

To launch the app, run: yarn run dev:back and yarn run dev:front in two terminal instances.

The front will be available at http://localhost:4200 and the back at http://localhost:3000.

All API calls made to the front will be transferred to the back.

Notes

As you have to follow eslint and tslint configured guidelines, you can install these plugins to watch linter errors.

The app uses nodemon to watch for code change. The app will restart or reload when you edit the code.


Developing - Docker

To contribute to the project you will need:

Use cd to the root directory of the project.

Configuration

.env file

To configure your environment, copy /tools/config-samples/.env.docker.example to /.env. Then you just have to edit field as you want (cp tools/config-samples/.env.docker.example .env).

P.S.: The file .env is already ignored by git.

proxy.conf.json

As the project could be used in two different dev env, we need two different configurations for the proxy of the front.

Here, we want to use the docker configuration. So just copy the docker.proxy.conf.json file using: cp docker.proxy.conf.json proxy.conf.json

P.S.: The file proxy.conf.json is already ignored by git.

Lunch containers!

Then: docker-compose up

docker-compose will create 4 different containers:

  • k-app-mongo: a mongodb server
  • k-app-mysql: a mysql server
  • k-app-back: which run the node process of the backend
  • k-app-front: which run the process of the frontend

Testing (back only)

Launch the tests: yarn test

Create coverage report: yarn run coverage