Refine backend README.md

This commit is contained in:
Wolfgang Huß 2021-10-04 13:03:04 +02:00
parent df4a5b7390
commit d57c02c48e

View File

@ -7,8 +7,9 @@ Run the following command to install everything through docker.
The installation takes a bit longer on the first pass or on rebuild ...
```bash
# in main folder
$ docker-compose up
# or
# rebuild the containers for a cleanup
$ docker-compose up --build
```
@ -28,6 +29,7 @@ between different local node versions.
Install node dependencies with [yarn](https://yarnpkg.com/en/):
```bash
# in main folder
$ cd backend
$ yarn install
```
@ -45,12 +47,14 @@ a [local Neo4J](http://localhost:7474) instance is up and running.
Start the backend for development with:
```bash
# in backend/
$ yarn run dev
```
or start the backend in production environment with:
```bash
# in backend/
$ yarn run start
```
@ -72,6 +76,7 @@ backend is running:
{% tab title="Docker" %}
```bash
# in main folder while docker-compose is running
$ docker-compose exec backend yarn run db:migrate init
```
@ -79,7 +84,7 @@ $ docker-compose exec backend yarn run db:migrate init
{% tab title="Without Docker" %}
```bash
# in folder backend/
# in folder backend/ while database is running
# make sure your database is running on http://localhost:7474/browser/
yarn run db:migrate init
```
@ -98,12 +103,14 @@ need to seed your database:
In another terminal run:
```bash
# in main folder while docker-compose is running
$ docker-compose exec backend yarn run db:seed
```
To reset the database run:
```bash
# in main folder while docker-compose is running
$ docker-compose exec backend yarn run db:reset
# you could also wipe out your neo4j database and delete all volumes with:
$ docker-compose down -v
@ -117,12 +124,14 @@ $ docker-compose exec backend yarn run db:migrate init
Run:
```bash
# in backend/ while database is running
$ yarn run db:seed
```
To reset the database run:
```bash
# in backend/ while database is running
$ yarn run db:reset
```
@ -140,6 +149,7 @@ you have to migrate your data e.g. because your data modeling has changed.
Generate a data migration file:
```bash
# in main folder while docker-compose is running
$ docker-compose exec backend yarn run db:migrate:create your_data_migration
# Edit the file in ./src/db/migrations/
```
@ -147,6 +157,7 @@ $ docker-compose exec backend yarn run db:migrate:create your_data_migration
To run the migration:
```bash
# in main folder while docker-compose is running
$ docker-compose exec backend yarn run db:migrate up
```
@ -156,6 +167,7 @@ $ docker-compose exec backend yarn run db:migrate up
Generate a data migration file:
```bash
# in backend/
$ yarn run db:migrate:create your_data_migration
# Edit the file in ./src/db/migrations/
```
@ -163,6 +175,7 @@ $ yarn run db:migrate:create your_data_migration
To run the migration:
```bash
# in backend/ while database is running
$ yarn run db:migrate up
```
@ -180,6 +193,7 @@ database after each test, running the tests will wipe out all your data!
Run the unit tests:
```bash
# in main folder while docker-compose is running
$ docker-compose exec backend yarn run test
```
@ -190,6 +204,7 @@ $ docker-compose exec backend yarn run test
Run the unit tests:
```bash
# in backend/ while database is running
$ yarn run test
```