- lrdf-idvisor-back: back express server to query database
- lrdf-idvisor-front: front app
- lrdf-idvisor-model: shared models between front and back
- database: used for debugging purposes
- Node: 12.13.1
- Yarn: 1.19.2
- Docker & docker-compose
- Install dependencies:
yarn
- Launch db:
cd dev-database && docker-compose up -d
- Launch back:
npm run start-back
- Launch front:
npm run start-front
Place .env files at the root of its project
lrdf-idvisor-back:
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_DB=postgres
SERVER_PORT=4000
[email protected]
PGADMIN_DEFAULT_PASSWORD=test
FRONT_ADRESS=localhost:3000
lrdf-idvisor-front:
REACT_APP_BACK_ADRESS=localhost:4000
!!!SHOULD BE USED FOR ANY TYPE OF DATA, EVEN STATIC ONES!!!
In order to manipulate data, Redux is available in the project. Here are the steps to use data:
- Create a model in a new file:
data/models
- Add it to SessionsState:
data/sessions/sessions.state.ts
- Get the data in:
data/dataApi.ts
- Make the data available with a selector:
data/selectors.ts
- Use
connect
andmapStateToProps
to pass it to your component
Nota bene: A simple example can be found in pages/Home.tsx
with the Slides component.
- Go to the right part of the project
- For production libraries :
yarn add 'package'
- For development libraries :
yarn add 'package' --dev
- Port: 3000
- Port: 4000
- Port: 5432
- user: postgres
Nota bene: command to connect psql -U postgres
- Port: 8080
- mail: [email protected]
- password: test
[tutorial](documentation : https://wanago.io/2019/01/14/express-postgres-relational-databases-typeorm/)
const sessionSelector = (state: RootState) => state.session
const username = createSelector(
sessionSelector,
session => {
return session.username
}
)
const mapState = (state: RootState) => ({
username: username(state)
})