README.md 1.75 KB
Newer Older
1
# BioStudies - Submission Tool
mdylag's avatar
iREADME  
mdylag committed
2

Nestor Diaz's avatar
Nestor Diaz committed
3
- Angular v10
4 5
- ExpressJS v4
- Node v10.16.2
mdylag's avatar
iREADME  
mdylag committed
6

7 8 9 10 11 12 13 14
## Getting Started

### 1. Configure
This project uses [config](https://www.npmjs.com/package/config) module which expects a `.env` file in the root directory.

Create a `.env` file in the root of the project and copy / pase the next environment variable definitions in it:

```js
15
PORT=port
16 17 18
BACKEND_PATH_CONTEXT=pathname
BACKEND_HOST_NAME=hostname
BACKEND_PORT=port
mdylag's avatar
iREADME  
mdylag committed
19 20
```

21
- `PORT` is the service proxy (Node) port
22 23 24 25 26 27 28 29
- `BACKEND_PATH_CONTEXT` is the pathname of the backend service URL
- `BACKEND_HOST_NAME` is the hostname or backend URI
- `BACKEND_PORT` is the port where the backend is running

### 2. Install dependencies
Be sure your local environment has `Node v10.16.2` and `NPM v6.9.0` at least.

Run the next script to install dependencies:
mdylag's avatar
iREADME  
mdylag committed
30 31

```
32
 npm install
mdylag's avatar
iREADME  
mdylag committed
33 34
```

35 36
### 3. Run in development mode
Run the next script to execute the application in **development mode**:
mdylag's avatar
iREADME  
mdylag committed
37
```
38
npm run start:dev
mdylag's avatar
iREADME  
mdylag committed
39 40
```

41 42 43
- The `npm run start:dev` will run a **Node + Express** service which proxies the requests to **BioStudies** backend and a **Angular Dev Server** to get local development benefits (hot reload + live TS compilation)
- By default **Node + Express** service runs on `8080` port
- By default **Angular Dev Server** service runs on `4200` port
44
- If `PORT` is changed, it should be updated in the `proxy.config.json` file which is the **Angular Dev Proxy** configuration file
45 46 47 48 49 50

## Run production mode
Make sure you have the `.env` file created as it's described in **Getting Started - Configure**

Run the next steps to build and execute the application in  **production** mode:

olgamelnichuk's avatar
olgamelnichuk committed
51
```
52 53 54 55
npm run build
cp .env ./dist
cd ./dist
npm run node:prod
mdylag's avatar
iREADME  
mdylag committed
56 57
```

olgamelnichuk's avatar
olgamelnichuk committed
58
### Tests ###
59 60 61 62 63
Run the next script to execute unit tests:

```
npm run test
```