From 15cf41e7e11f4e5bbe44ba289d312852507405e5 Mon Sep 17 00:00:00 2001 From: Tom <20648924+moT01@users.noreply.github.com> Date: Thu, 15 Oct 2020 10:01:10 -0500 Subject: [PATCH] fix(learn): Update basic node express instructions to remove them from boilerplates (#39953) * fix: adjust instuctions so we can remove them all from the boilerplate * fix: adjust instuctions so we can remove them all from the boilerplate --- .../start-a-working-express-server.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/curriculum/challenges/english/05-apis-and-microservices/basic-node-and-express/start-a-working-express-server.md b/curriculum/challenges/english/05-apis-and-microservices/basic-node-and-express/start-a-working-express-server.md index ba49a907f6..a79a9e7ec1 100644 --- a/curriculum/challenges/english/05-apis-and-microservices/basic-node-and-express/start-a-working-express-server.md +++ b/curriculum/challenges/english/05-apis-and-microservices/basic-node-and-express/start-a-working-express-server.md @@ -7,7 +7,8 @@ forumTopicId: 301519 ## Description
-In the first two lines of the file myApp.js, you can see how easy it is to create an Express app object. This object has several methods, and you will learn many of them in these challenges. One fundamental method is app.listen(port). It tells your server to listen on a given port, putting it in running state. You can see it at the bottom of the file. It is inside comments because, for testing reasons, we need the app to be running in the background. All the code that you may want to add goes between these two fundamental parts. Repl.it stores the port number in the environment variable process.env.PORT. Its value is 3000. +In the first two lines of the file myApp.js, you can see how easy it is to create an Express app object. This object has several methods, and you will learn many of them in these challenges. One fundamental method is app.listen(port). It tells your server to listen on a given port, putting it in running state. For testing reasons, we need the app to be running in the background so we added this method in the `server.js` file for you. + Let’s serve our first string! In Express, routes takes the following structure: app.METHOD(PATH, HANDLER). METHOD is an http method in lowercase. PATH is a relative path on the server (it can be a string, or even a regular expression). HANDLER is a function that Express calls when the route is matched. Handlers take the form function(req, res) {...}, where req is the request object, and res is the response object. For example, the handler @@ -22,8 +23,8 @@ will serve the string 'Response String'. ## Instructions
-Use the app.get() method to serve the string "Hello Express" to GET requests matching the / (root) path. -Note: Be sure that your code works by looking at the logs, then see the results in the preview if you are using Repl.it. +Use the app.get() method to serve the string "Hello Express" to GET requests matching the / (root) path. Be sure that your code works by looking at the logs, then see the results in the preview if you are using Repl.it. +Note: All the code for these lessons should be added in between the few lines of code we have started you off with.
## Tests