Skip to content

Commit 36775fc

Browse files
authored
Merge pull request #3535 from stritch-dev/source
Removal of "Taken into use" and other phrasing changes.
2 parents 57aec28 + 9f94cfc commit 36775fc

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/content/3/en/part3a.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ In the first row, the application imports Node's built-in [web server](https://n
152152
import http from 'http'
153153
```
154154

155-
These days, code that runs in the browser uses ES6 modules. Modules are defined with an [export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) and taken into use with an [import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import).
155+
These days, code that runs in the browser uses ES6 modules. Modules are defined with an [export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) and included in the current file with an [import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import).
156156

157157
Node.js uses [CommonJS](https://en.wikipedia.org/wiki/CommonJS) modules. The reason for this is that the Node ecosystem needed modules long before JavaScript supported them in the language specification. Currently, Node also supports the use of ES6 modules, but since the support is not quite perfect yet, we'll stick to CommonJS modules.
158158

@@ -956,7 +956,7 @@ Middleware are functions that can be used for handling _request_ and _response_
956956

957957
The json-parser we used earlier takes the raw data from the requests that are stored in the _request_ object, parses it into a JavaScript object and assigns it to the _request_ object as a new property <i>body</i>.
958958

959-
In practice, you can use several middlewares at the same time. When you have more than one, they're executed one by one in the order that they were taken into use in express.
959+
In practice, you can use several middlewares at the same time. When you have more than one, they're executed one by one in the order that they were listed in the application code.
960960

961961
Let's implement our own middleware that prints information about every request that is sent to the server.
962962

@@ -974,15 +974,15 @@ const requestLogger = (request, response, next) => {
974974

975975
At the end of the function body, the _next_ function that was passed as a parameter is called. The _next_ function yields control to the next middleware.
976976

977-
Middleware is taken into use like this:
977+
Middleware is used like this:
978978

979979
```js
980980
app.use(requestLogger)
981981
```
982982

983-
Middleware functions are called in the order that they're taken into use with the express server object's _use_ method. Notice that json-parser is taken into use before the _requestLogger_ middleware, because otherwise <i>request.body</i> will not be initialized when the logger is executed!
983+
Remember, middleware functions are called in the order that they're encountered by the JavaScript engine. Notice that _json-parser_ is listed before _requestLogger_ , because otherwise <i>request.body</i> will not be initialized when the logger is executed!
984984

985-
Middleware functions have to be taken into use before routes if we want them to be executed before the route event handlers are called. There are also situations where we want to define middleware functions after routes. In practice, this means that we are defining middleware functions that are only called if no route handles the HTTP request.
985+
Middleware functions have to be used before routes when we want them to be executed by the route event handlers. Sometimes, we want to use middleware functions after routes. We do this this when the middleware functions are only called if no route handles process the HTTP request.
986986

987987
Let's add the following middleware after our routes. This middleware will be used for catching requests made to non-existent routes. For these requests, the middleware will return an error message in the JSON format.
988988

src/content/3/en/part3c.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ When bugs occur, <i>the worst of all possible strategies</i> is to continue writ
7171

7272
### MongoDB
7373

74-
To store our saved notes indefinitely, we need a database. Most of the courses taught at the University of Helsinki use relational databases. In most parts of this course, we will use [MongoDB](https://www.mongodb.com/) which is a so-called [document database](https://en.wikipedia.org/wiki/Document-oriented_database).
74+
To store our saved notes indefinitely, we need a database. Most of the courses taught at the University of Helsinki use relational databases. In most parts of this course, we will use [MongoDB](https://www.mongodb.com/) which is [document database](https://en.wikipedia.org/wiki/Document-oriented_database).
7575

7676
The reason for using Mongo as the database is its lower complexity compared to a relational database. [Part 13](/en/part13) of the course shows how to build Node.js backends that use a relational database.
7777

@@ -235,7 +235,7 @@ const note = new Note({
235235
})
236236
```
237237

238-
Models are so-called <i>constructor functions</i> that create new JavaScript objects based on the provided parameters. Since the objects are created with the model's constructor function, they have all the properties of the model, which include methods for saving the object to the database.
238+
Models are <i>constructor functions</i> that create new JavaScript objects based on the provided parameters. Since the objects are created with the model's constructor function, they have all the properties of the model, which include methods for saving the object to the database.
239239

240240
Saving the object to the database happens with the appropriately named _save_ method, which can be provided with an event handler with the _then_ method:
241241

0 commit comments

Comments
 (0)