You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/3/en/part3b.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ Render might be a bit easier to use since it does not require any software to be
99
99
100
100
There are also some other free hosting options that work well for this course, at least for all parts other than part 11 (CI/CD) that might have one tricky exercise for other platforms.
101
101
102
-
Some course participants have also used the following
102
+
Some course participants have also used the following services:
103
103
104
104
-[Cyclic](https://www.cyclic.sh/)
105
105
-[Replit](https://replit.com)
@@ -146,7 +146,7 @@ Give the app a name or let Fly.io auto-generate one. Pick a region where the app
146
146
147
147
The last question is "Would you like to deploy now?". We should answer "no" since we are not quite ready yet.
148
148
149
-
Fly.io creates a file <i>fly.toml</i> in the root of your app where the app is configured. To get the app up and running we <i>might</i> need to do a small addition to the configuration:
149
+
Fly.io creates a file <i>fly.toml</i> in the root of your app where we can configure it. To get the app up and running we <i>might</i> need to do a small addition to the configuration:
150
150
151
151
```bash
152
152
[build]
@@ -207,7 +207,6 @@ Whenever you make changes to the application, you can take the new version to pr
207
207
fly deploy
208
208
```
209
209
210
-
211
210
#### Render
212
211
213
212
The following assumes that the [sign in](https://dashboard.render.com/) has been made with a GitHub account.
@@ -255,7 +254,7 @@ So far we have been running React code in <i>development mode</i>. In developmen
255
254
256
255
When the application is deployed, we must create a [production build](https://vitejs.dev/guide/build.html) or a version of the application which is optimized for production.
257
256
258
-
A production build of applications created with Vite can be created with the command [npm run build](https://vitejs.dev/guide/build.html).
257
+
A production build for applications created with Vite can be created with the command [npm run build](https://vitejs.dev/guide/build.html).
259
258
260
259
Let's run this command from the <i>root of the notes frontend project</i> that we developed in [Part 2](/en/part2).
261
260
@@ -281,7 +280,7 @@ If you are using a Windows computer, you may use either [copy](https://www.windo
281
280
282
281
The backend directory should now look as follows:
283
282
284
-

283
+

285
284
286
285
To make express show <i>static content</i>, the page <i>index.html</i> and the JavaScript, etc., it fetches, we need a built-in middleware from Express called [static](http://expressjs.com/en/starter/static-files.html).
287
286
@@ -313,7 +312,7 @@ After the change, we have to create a new production build of the frontend and c
313
312
314
313
The application can now be used from the <i>backend</i> address <http://localhost:3001>:

317
316
318
317
Our application now works exactly like the [single-page app](/en/part0/fundamentals_of_web_apps#single-page-app) example application we studied in part 0.
319
318
@@ -376,7 +375,7 @@ The application needs a database. Before we introduce one, let's go through a fe
376
375
377
376
The setup now looks like as follows:
378
377
379
-

378
+

380
379
381
380
The node/express-backend now resides in the Fly.io/Render server. When the root address is accessed, the browser loads and executes the React app that fetches the json-data from the Fly.io/Render server.
382
381
@@ -386,7 +385,7 @@ To create a new production build of the frontend without extra manual work, let'
386
385
387
386
#### Fly.io script
388
387
389
-
The script looks like this:
388
+
The scripts look like this:
390
389
391
390
```json
392
391
{
@@ -401,14 +400,15 @@ The script looks like this:
401
400
```
402
401
403
402
##### Note for Windows users
403
+
404
404
Note that the standard shell commands in `build:ui` do not natively work in Windows. Powershell in Windows works differently, in which case the script could be written as
405
+
405
406
```json
406
407
"build:ui":"@powershell Remove-Item -Recurse -Force dist && cd ../frontend && npm run build && @powershell Copy-Item dist -Recurse ../backend",
407
408
```
408
409
409
410
If the script does not work on Windows, confirm that you are using Powershell and not Command Prompt. If you have installed Git Bash or another Linux-like terminal, you may be able to run Linux-like commands on Windows as well.
410
411
411
-
412
412
The script _npm run build:ui_ builds the frontend and copies the production version under the backend repository. The script _npm run deploy_ releases the current backend to Fly.io.
413
413
414
414
_npm run deploy:full_ combines these two scripts, i.e., _npm run build:ui_ and _npm run deploy_.
@@ -488,7 +488,7 @@ Note that with the vite-configuration shown above, only requests that are made t
488
488
489
489
Now the frontend is also fine, working with the server both in development and production mode.
490
490
491
-
A negative aspect of our approach is how complicated it is to deploy the frontend. Deploying a new version requires generating a new production build of the frontend and copying it to the backend repository. This makes creating an automated [deployment pipeline](https://martinfowler.com/bliki/DeploymentPipeline.html) more difficult. Deployment pipeline means an automated and controlled way to move the code from the computer of the developer through different tests and quality checks to the production environment. Building a deployment pipeline is the topic of [part 11](https://fullstackopen.com/en/part11) of this course. There are multiple ways to achieve this, for example, placing both backend and frontend code in the same repository but we will not go into those now.
491
+
A negative aspect of our approach is how complicated it is to deploy the frontend. Deploying a new version requires generating a new production build of the frontend and copying it to the backend repository. This makes creating an automated [deployment pipeline](https://martinfowler.com/bliki/DeploymentPipeline.html) more difficult. Deployment pipeline means an automated and controlled way to move the code from the computer of the developer through different tests and quality checks to the production environment. Building a deployment pipeline is the topic of [part 11](/en/part11) of this course. There are multiple ways to achieve this, for example, placing both backend and frontend code in the same repository but we will not go into those now.
492
492
493
493
In some situations, it may be sensible to deploy the frontend code as its own application.
494
494
@@ -502,13 +502,13 @@ The current backend code can be found on [Github](https://github.com/fullstack-h
502
502
503
503
The following exercises don't require many lines of code. They can however be challenging, because you must understand exactly what is happening and where, and the configurations must be just right.
504
504
505
-
#### 3.9 phonebook backend step9
505
+
#### 3.9 Phonebook backend step 9
506
506
507
507
Make the backend work with the phonebook frontend from the exercises of the previous part. Do not implement the functionality for making changes to the phone numbers yet, that will be implemented in exercise 3.17.
508
508
509
509
You will probably have to do some small changes to the frontend, at least to the URLs for the backend. Remember to keep the developer console open in your browser. If some HTTP requests fail, you should check from the <i>Network</i>-tab what is going on. Keep an eye on the backend's console as well. If you did not do the previous exercise, it is worth it to print the request data or <i>request.body</i> to the console in the event handler responsible for POST requests.
510
510
511
-
#### 3.10 phonebook backend step10
511
+
#### 3.10 Phonebook backend step 10
512
512
513
513
Deploy the backend to the internet, for example to Fly.io or Render.
514
514
@@ -522,11 +522,11 @@ Create a README.md at the root of your repository, and add a link to your online
522
522
523
523
You shall NOT be deploying the frontend directly at any stage of this part. It is just backend repository that is deployed throughout the whole part, nothing else.
524
524
525
-
#### 3.11 phonebook full stack
525
+
#### 3.11 Full Stack Phonebook
526
526
527
-
Generate a production build of your frontend, and add it to the internet application using the method introduced in this part.
527
+
Generate a production build of your frontend, and add it to the Internet application using the method introduced in this part.
528
528
529
-
**NB** If you use Render, make sure the directory <i>dist</i> is not gitignored
529
+
**NB** If you use Render, make sure the directory <i>dist</i> is not ignored by git.
530
530
531
531
Also, make sure that the frontend still works locally (in development mode when started with command _npm run dev_).
0 commit comments