| ... | @@ -4,33 +4,31 @@ |
... | @@ -4,33 +4,31 @@ |
|
|
|
|
|
|
|
Backendin GraphQL voi käyttää erilaisia tietokantoja.
|
|
Backendin GraphQL voi käyttää erilaisia tietokantoja.
|
|
|
|
|
|
|
|
* 1. Valitse ja asenna yksi seuraavista tietokannoista: MySQL, SQLite, Postgres tai MSSQL.
|
|
1. Valitse ja asenna yksi seuraavista tietokannoista: MySQL, SQLite, Postgres tai MSSQL.
|
|
|
* 2. Luo tietokantaan tietokanta (schema) haluamallasi nimellä.
|
|
2. Luo tietokantaan tietokanta (schema) haluamallasi nimellä.
|
|
|
|
|
|
|
|
## 2. Backend
|
|
## 2. Backend
|
|
|
|
|
|
|
|
* 1. Lataa backendin lähdekoodi
|
|
1. Lataa backendin lähdekoodi
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
git clone https://gitlab.labranet.jamk.fi/OverFlow/Backend.git backend
|
|
git clone https://gitlab.labranet.jamk.fi/OverFlow/Backend.git backend
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
* 2. Asenna tarvittavat paketit
|
|
2. Asenna tarvittavat paketit
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
cd backend
|
|
cd backend
|
|
|
npm install
|
|
npm i
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Asetukset
|
|
3. Kopioi asetustiedoston malli oikeaksi asetustiedostoksi.
|
|
|
|
|
|
|
|
* 1. Kopioi asetustiedoston malli oikeaksi asetustiedostoksi.
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
cp src/config/config.template src/config/config.js
|
|
cp src/config/config.template src/config/config.js
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
* 2. Täytä asetukset
|
|
4. Täytä asetukset config.js tiedostoon.
|
|
|
* api: portti jossa itse backend pyörii
|
|
* api: portti jossa itse backend pyörii
|
|
|
* db.dialect: tietokanta, jonka sensit [mysql|sqlite|postgres|mssql]
|
|
* db.dialect: tietokanta, jonka sensit [mysql|sqlite|postgres|mssql]
|
|
|
* db.schema: luomasi tietokannan nimi
|
|
* db.schema: luomasi tietokannan nimi
|
| ... | @@ -71,3 +69,87 @@ export default Config; |
... | @@ -71,3 +69,87 @@ export default Config; |
|
|
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
## Frontend
|
|
|
|
|
|
|
|
|
|
|
|
1. Lataa backendin lähdekoodi
|
|
|
|
|
|
|
|
```
|
|
|
|
git clone https://gitlab.labranet.jamk.fi/OverFlow/Frontend.git frontend
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Asenna tarvittavat paketit
|
|
|
|
|
|
|
|
```
|
|
|
|
cd frontend
|
|
|
|
npm i -g @angular/cli
|
|
|
|
npm i
|
|
|
|
```
|
|
|
|
|
|
|
|
3. Kopioi asetustiedostojen mallit oikeiksi asetustiedostoiksi.
|
|
|
|
|
|
|
|
```
|
|
|
|
cp src/app/core/config/app.config.template src/app/core/config/app.config.ts
|
|
|
|
cp src/app/core/config/stomp.config.template src/app/core/config/stomp.config.ts
|
|
|
|
```
|
|
|
|
|
|
|
|
4. Täytä asetukset *.config.ts tiedostoihin
|
|
|
|
* apiEndpoint: backendin rajapinnan osoite
|
|
|
|
* agmApiKey: google maps API avain
|
|
|
|
* headers.login: rabbitMQ käyttäjätunnus
|
|
|
|
* headers.passcode: rabbitMQ salasana
|
|
|
|
|
|
|
|
Esimerkki app.config.ts tiedostosta:
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
|
|
|
import { InjectionToken } from '@angular/core';
|
|
|
|
|
|
|
|
export interface ApplicationConfig {
|
|
|
|
apiEndpoint: string;
|
|
|
|
agmApiKey: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const APP_DI_CONFIG: ApplicationConfig = {
|
|
|
|
apiEndpoint: 'http://localhost:9000/api',
|
|
|
|
agmApiKey: 'googlemapsapiavain'
|
|
|
|
};
|
|
|
|
|
|
|
|
export const APP_CONFIG = new InjectionToken<ApplicationConfig>('app.config');
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
Esimerkki stomp.config.ts tiedostosta:
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
|
|
|
import { InjectionToken } from '@angular/core';
|
|
|
|
|
|
|
|
export interface StompConfig {
|
|
|
|
endpoint: string,
|
|
|
|
headers: {
|
|
|
|
login: string,
|
|
|
|
passcode: string
|
|
|
|
},
|
|
|
|
heartbeat_in: number,
|
|
|
|
heartbeat_out: number,
|
|
|
|
reconnect_delay: number,
|
|
|
|
debug: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
export const STOMP_DI_CONFIG: StompConfig = {
|
|
|
|
endpoint: 'ws://127.0.0.1:15674/ws',
|
|
|
|
headers: {
|
|
|
|
login: 'overflow',
|
|
|
|
passcode: 'sikapossu'
|
|
|
|
},
|
|
|
|
heartbeat_in: 0,
|
|
|
|
heartbeat_out: 20000,
|
|
|
|
reconnect_delay: 5000,
|
|
|
|
debug: true
|
|
|
|
};
|
|
|
|
|
|
|
|
export const STOMP_CONFIG = new InjectionToken<StompConfig>('stomp.config');
|
|
|
|
|
|
|
|
```
|
|
|
|
|