Skip to content

Commit b3aa10e

Browse files
committed
Replace nodemon with node --watch in part4
1 parent dfbad52 commit b3aa10e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/content/4/en/part4a.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ app.listen(PORT, () => {
460460
})
461461
```
462462
463-
Turn the application into a functioning <i>npm</i> project. To keep your development productive, configure the application to be executed with <i>nodemon</i>. You can create a new database for your application with MongoDB Atlas, or use the same database from the previous part's exercises.
463+
Turn the application into a functioning <i>npm</i> project. To keep your development productive, configure the application to be executed with <i>node --watch</i>. You can create a new database for your application with MongoDB Atlas, or use the same database from the previous part's exercises.
464464
465465
Verify that it is possible to add blogs to the list with Postman or the VS Code REST client and that the application returns the added blogs at the correct endpoint.
466466
@@ -521,7 +521,7 @@ Let's define the <i>npm script _test_</i> for the test execution:
521521
//...
522522
"scripts": {
523523
"start": "node index.js",
524-
"dev": "nodemon index.js",
524+
"dev": "node --watch index.js",
525525
"build:ui": "rm -rf build && cd ../frontend/ && npm run build && cp -r build ../backend",
526526
"deploy": "fly deploy",
527527
"deploy:full": "npm run build:ui && npm run deploy",

src/content/4/en/part4b.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Next, let's change the scripts in our notes application <i>package.json</i> file
2828
// ...
2929
"scripts": {
3030
"start": "NODE_ENV=production node index.js", // highlight-line
31-
"dev": "NODE_ENV=development nodemon index.js", // highlight-line
31+
"dev": "NODE_ENV=development node --watch index.js", // highlight-line
3232
"test": "NODE_ENV=test node --test", // highlight-line
3333
"build:ui": "rm -rf build && cd ../frontend/ && npm run build && cp -r build ../backend",
3434
"deploy": "fly deploy",
@@ -40,7 +40,7 @@ Next, let's change the scripts in our notes application <i>package.json</i> file
4040
}
4141
```
4242

43-
We specified the mode of the application to be <i>development</i> in the _npm run dev_ script that uses nodemon. We also specified that the default _npm start_ command will define the mode as <i>production</i>.
43+
We specified the mode of the application to be <i>development</i> in the _npm run dev_ script. We also specified that the default _npm start_ command will define the mode as <i>production</i>.
4444

4545
There is a slight issue in the way that we have specified the mode of the application in our scripts: it will not work on Windows. We can correct this by installing the [cross-env](https://www.npmjs.com/package/cross-env) package as a development dependency with the command:
4646

@@ -55,7 +55,7 @@ We can then achieve cross-platform compatibility by using the cross-env library
5555
// ...
5656
"scripts": {
5757
"start": "cross-env NODE_ENV=production node index.js",
58-
"dev": "cross-env NODE_ENV=development nodemon index.js",
58+
"dev": "cross-env NODE_ENV=development node --watch index.js",
5959
"test": "cross-env NODE_ENV=test node --test",
6060
// ...
6161
},

src/content/4/fi/osa4a.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ app.listen(PORT, () => {
450450
})
451451
```
452452
453-
Tee sovelluksesta toimiva <i>npm</i>-projekti. Jotta sovelluskehitys olisi sujuvaa, konfiguroi sovellus suoritettavaksi <i>nodemonilla</i>. Voit luoda sovellukselle uuden tietokannan MongoDB Atlasiin tai käyttää edellisen osan sovelluksen tietokantaa.
453+
Tee sovelluksesta toimiva <i>npm</i>-projekti. Jotta sovelluskehitys olisi sujuvaa, konfiguroi sovellus suoritettavaksi komennolla <i>node --watch</i>. Voit luoda sovellukselle uuden tietokannan MongoDB Atlasiin tai käyttää edellisen osan sovelluksen tietokantaa.
454454
455455
Varmista, että sovellukseen on mahdollista lisätä blogeja Postmanilla tai VS Code REST Clientilla ja että sovellus näyttää lisätyt blogit.
456456
@@ -508,7 +508,7 @@ Määritellään npm-skripti <i>test</i> testien suorittamiseen:
508508
//...
509509
"scripts": {
510510
"start": "node index.js",
511-
"dev": "nodemon index.js",
511+
"dev": "node --watch index.js",
512512
"build:ui": "rm -rf build && cd ../frontend/ && npm run build && cp -r build ../backend",
513513
"deploy": "fly deploy",
514514
"deploy:full": "npm run build:ui && npm run deploy",

src/content/4/fi/osa4b.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Määritellään nyt tiedostossa <i>package.json</i>, että testejä suoritettae
2626
// ...
2727
"scripts": {
2828
"start": "NODE_ENV=production node index.js", // highlight-line
29-
"dev": "NODE_ENV=development nodemon index.js", // highlight-line
29+
"dev": "NODE_ENV=development node --watch index.js", // highlight-line
3030
"test": "NODE_ENV=test node --test", // highlight-line
3131
"build:ui": "rm -rf build && cd ../frontend/ && npm run build && cp -r build ../backend",
3232
"deploy": "fly deploy",
@@ -38,7 +38,7 @@ Määritellään nyt tiedostossa <i>package.json</i>, että testejä suoritettae
3838
}
3939
```
4040

41-
Samalla määriteltiin, että suoritettaessa sovellusta komennolla _npm run dev_ eli nodemonin avulla, on sovelluksen moodi <i>development</i>. Jos sovellusta suoritetaan normaalisti Nodella, on moodiksi määritelty <i>production</i>.
41+
Samalla määriteltiin, että suoritettaessa sovellusta komennolla _npm run dev_ sovelluksen moodi on <i>development</i>. Jos sovellusta suoritetaan komennolla _npm start_, on moodiksi määritelty <i>production</i>.
4242

4343
Määrittelyssämme on kuitenkin pieni ongelma: se ei toimi Windowsilla. Tilanne korjautuu asentamalla kirjasto [cross-env](https://www.npmjs.com/package/cross-env) kehitysaikaiseksi riippuvuudeksi komennolla
4444

@@ -53,7 +53,7 @@ ja muuttamalla <i>package.json</i> kaikilla käyttöjärjestelmillä toimivaan m
5353
// ...
5454
"scripts": {
5555
"start": "cross-env NODE_ENV=production node index.js",
56-
"dev": "cross-env NODE_ENV=development nodemon index.js",
56+
"dev": "cross-env NODE_ENV=development node --watch index.js",
5757
"test": "cross-env NODE_ENV=test node --test",
5858
},
5959
// ...

0 commit comments

Comments
 (0)