Skip to content

Commit edaaeec

Browse files
committed
Fix minor issues with code style
1 parent 7320fb9 commit edaaeec

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/content/3/en/part3c.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,14 @@ Let's not add any code dealing with Mongo to our backend just yet. Instead, let'
126126
```js
127127
const mongoose = require('mongoose')
128128

129-
if (process.argv.length<3) {
129+
if (process.argv.length < 3) {
130130
console.log('give password as argument')
131131
process.exit(1)
132132
}
133133

134134
const password = process.argv[2]
135135

136-
const url =
137-
`mongodb+srv://fullstack:${password}@cluster0.a5qfl.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0`
136+
const url = `mongodb+srv://fullstack:${password}@cluster0.a5qfl.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0`
138137

139138
mongoose.set('strictQuery',false)
140139

@@ -181,8 +180,7 @@ As the view states, the <i>document</i> matching the note has been added to the
181180
Let's destroy the default database <i>test</i> and change the name of the database referenced in our connection string to <i>noteApp</i> instead, by modifying the URI:
182181

183182
```js
184-
const url =
185-
`mongodb+srv://fullstack:${password}@cluster0.a5qfl.mongodb.net/noteApp?retryWrites=true&w=majority&appName=Cluster0`
183+
const url = `mongodb+srv://fullstack:${password}@cluster0.a5qfl.mongodb.net/noteApp?retryWrites=true&w=majority&appName=Cluster0`
186184
```
187185

188186
Let's run our code again:
@@ -569,7 +567,7 @@ Creating a new note is accomplished like this:
569567
app.post('/api/notes', (request, response) => {
570568
const body = request.body
571569

572-
if (body.content === undefined) {
570+
if (!body.content) {
573571
return response.status(400).json({ error: 'content missing' })
574572
}
575573

src/content/3/fi/osa3c.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,14 @@ Ei lisätä MongoDB:tä käsittelevää koodia heti backendin koodin sekaan, vaa
124124
```js
125125
const mongoose = require('mongoose')
126126

127-
if (process.argv.length<3) {
127+
if (process.argv.length < 3) {
128128
console.log('give password as argument')
129129
process.exit(1)
130130
}
131131

132132
const password = process.argv[2]
133133

134-
const url =
135-
`mongodb+srv://fullstack:${password}@cluster0.a5qfl.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0`
134+
const url = `mongodb+srv://fullstack:${password}@cluster0.a5qfl.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0`
136135

137136
mongoose.set('strictQuery', false)
138137
mongoose.connect(url)
@@ -174,8 +173,7 @@ Kuten näkymä kertoo, on muistiinpanoa vastaava <i>dokumentti</i> lisätty tiet
174173
Tuhotaan oletusarvoisen nimen saanut kanta <i>test</i>. Päätetään käyttää tietokannasta nimeä <i>noteApp</i>, joten muutetaan tietokanta-URI muotoon
175174

176175
```js
177-
const url =
178-
`mongodb+srv://fullstack:${password}@cluster0.a5qfl.mongodb.net/noteApp?retryWrites=true&w=majority&appName=Cluster0`
176+
const url = `mongodb+srv://fullstack:${password}@cluster0.a5qfl.mongodb.net/noteApp?retryWrites=true&w=majority&appName=Cluster0`
179177
```
180178

181179
Suoritetaan ohjelma uudelleen:
@@ -562,7 +560,7 @@ Uuden muistiinpanon luominen tapahtuu seuraavasti:
562560
app.post('/api/notes', (request, response) => {
563561
const body = request.body
564562

565-
if (body.content === undefined) {
563+
if (!body.content) {
566564
return response.status(400).json({ error: 'content missing' })
567565
}
568566

0 commit comments

Comments
 (0)