From e75a788578b14b45817e85fc9b856fd237e09723 Mon Sep 17 00:00:00 2001 From: buzzcode2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:19:14 +0000 Subject: [PATCH] Modify task 1 as task 2 --- myApp.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/myApp.js b/myApp.js index 3574f8b..7fab971 100644 --- a/myApp.js +++ b/myApp.js @@ -2,9 +2,21 @@ let express = require('express'); let app = express(); class TestApp1 { + message = "Hello Express"; + default_path = "/"; + + /* Create a default response. */ + respond() { + return(this.message); + }; + + /* Handle requests and send default responses. */ + handle() { + app.get(this.default_path, (REQUEST, RESPONSE) => {RESPONSE.send(this.respond());}) + }; + constructor() { - let MESSAGE = "Hello World"; - console.log(MESSAGE); + this.handle(); } }