Skip to content

Commit 064a7bd

Browse files
author
hirsch88
committed
Revise getting started part
1 parent 438ec68 commit 064a7bd

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,30 @@ Install [Node.js and NPM](https://nodejs.org/en/download/)
4848
* on Windows use [chocolatey](https://chocolatey.org/) `choco install nodejs`
4949

5050
Install yarn globally
51-
```npm install yarn -g```
51+
```
52+
npm install yarn -g
53+
```
5254

5355
Install a MySQL database.
5456

55-
> If you work with a mac, we recommend to use homebrew for the installation
57+
> If you work with a mac, we recommend to use homebrew for the installation.
5658
5759
### Step 2: Create new Project
5860
Fork or download this project. Configure your package.json for your new project.
5961

60-
Then copy the example .env file and enter your database connection.
62+
Then copy the `example.env` file and rename it to `.env`. In this file you have to add your database connection information.
6163

62-
Create a new database. You will find the name in the .env file.
64+
Create a new database with the name you have in your `.env`-file.
6365

6466
Then setup your application environment.
6567
```
6668
npm run setup
6769
```
6870

69-
> This installs all dependencies with yarn. After that it migrates the database and seeds some test data into it.
71+
> This installs all dependencies with yarn. After that it migrates the database and seeds some test data into it. So after that your development environment is ready to use.
7072
7173
### Step 3: Serve your App
72-
Go to the project dir and start your app
74+
Go to the project dir and start your app with this npm script.
7375
```
7476
npm run serve
7577
```
@@ -78,18 +80,18 @@ npm run serve
7880
> The server address will be displayed to you as `http://0.0.0.0:3000`.
7981
8082
### Step 4: Create a new Resource
81-
Go to the project dir and hit this command
83+
Go to the project dir and hit this command in your terminal.
8284
```
8385
npm run console make:resource
8486
```
8587

86-
Apply the same information like you see below in the screenshot.
88+
Apply the same information like you see in the screenshot below.
8789

8890
![console](console.png)
8991

90-
> Now you have created a complete new endpoint in your api for the resource pets.
92+
> With that you just have created a complete new endpoint in your api for the resource pets.
9193
92-
We have to add the relationship between users an pets. Open the created migration file and replace the user property with these lines.
94+
Normally a pet belogns to a user, so we have to add the relationship between users an pets. Open the created migration file and replace the user property with these lines.
9395
```
9496
table.integer('user_id').unsigned();
9597
table.foreign('user_id').references('id').inTable('users').onDelete('cascade');
@@ -105,7 +107,7 @@ public user(): User {
105107
> The relationship between the users and pets are set and ready. So you can migrate your database with `npm run db:migrate`
106108
107109
### Step 5: Create a Seeder
108-
To generate some useful test data we need a smart factory for the pets. So open the ./src/database/factories/index.ts and add this code.
110+
To seed some cute pets we need a smart factory. So open the ./src/database/factories/index.ts and add this code.
109111
```
110112
/**
111113
* PET - Factory
@@ -120,9 +122,9 @@ factory.define(Pet, (faker: Faker.FakerStatic, args: any[]) => {
120122
});
121123
```
122124

123-
> So you have a pet factory to create sample data, but we need a seeder to run this awesome factory.
125+
> This factory helps us to create a fake pet to seed to the database.
124126
125-
Run this command in your terminal and call the new seeder "create pets".
127+
Run this command in your terminal and call the new seeder `create pets`.
126128
```
127129
npm run console make:seed
128130
```
@@ -135,6 +137,8 @@ await factory.get(Pet)
135137

136138
> Now we can seed some nice cats into the database with `npm run db:seed`.
137139
140+
> That was easy! Now its your turn to make something great out of it.
141+
138142
## Scripts / Tasks
139143
All script are defined in the package.json file, but the most important ones are listed here.
140144

0 commit comments

Comments
 (0)