K-Fet / K-App

K-App application repository
Apache License 2.0
7 stars 1 forks source link
angular continuous-integration insa-lyon k-fet nodejs

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:

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:


Testing (back only)

Launch the tests: yarn test

Create coverage report: yarn run coverage