Website is up, Docker is running, code is seen in webpage

parent 06c7964c
Pipeline #20951 passed with stages
in 2 minutes and 47 seconds
File added
#!/bin/bash
cd code
docker-compose up --build
docker cp gcc:/usr/src/code/area ..
docker-compose down
cd ../web
cp ../area ./cgi-bin/
docker-compose up --build
cd ..
\ No newline at end of file
......@@ -17,6 +17,11 @@ int main(int argc, char *argv[]) {
std::cout << "Value must be an integer above 0" << std::endl;
return 1;
}
s += 4;
std::string name = s;
if (strlen(s) == 0) {
name = "user";
}
float squareArea = areaOfSquareWithSides(argument);
float circleArea = areaOfCircleWithRadius(argument);
std::cout << "Content-type: text/html;\n\n"
......@@ -26,10 +31,17 @@ int main(int argc, char *argv[]) {
"<title>Area Calculator Results</title>"
"</head>"
"<body>"
"<p>The area of a square with sides of " << argument << " units is " << squareArea << " units.</p>"
"<p>The area of a circle with radius of "<< argument << " units is " << circleArea << " units.</p>"
"<p><a href=\"/\">Home</a></p>"
"</body>"
"</html>" << std::endl;
"<p>The area of a square with sides of "
<< argument << " units is " << squareArea
<< " units.</p>"
"<p>The area of a circle with radius of "
<< argument << " units is " << circleArea
<< " units.</p>"
"<p>Thank you for entering a value, "
<< name << ".</p>"
"<p><a href=\"/\">Home</a></p>"
"</body>"
"</html>"
<< std::endl;
return 0;
}
<html>
<body>
<h1>Wow! A docker container running!</h1>
</body>
</html>
\ No newline at end of file
<!doctype html>
<html itemtype="http://schema.org/WebPage" lang="en">
<head><meta charset="UTF-8">
<title>Area Calculator Form</title>
</head>
<body>
<form action="/cgi-bin/area" method="get">
<label for="side">Side:</label>
<input type="text" id="side" name="s">
<label for="name">Name:</label>
<input type="text" id="name" name="n">
<button type="submit">Calculate</button>
</form>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment