"use strict";
let app = require('express')();
app.get('/', function (request, response) {
response.end('Link1Link2Link4Email');
});
app.get('/link1', function (request, response) {
response.end('You are on link1');
});
app.get('/link2', function (request, response) {
response.end('You are on link2Link1Link3');
});
app.get('/link3', function (request, response) {
response.end('You are on link3Link1not exists');
});
app.get('/link4', function (request, response) {
response.redirect('/link1');
});
app.get('/redirectToNotFound', function (request, response) {
response.redirect('/notFound2');
});
app.get('/redirectToFound', function (request, response) {
response.redirect('/');
});
app.get('/redirect1', function (request, response) {
response.redirect('/link1');
});
app.get('/redirect2', function (request, response) {
response.redirect('/link1');
});
app.get('/twoRedirectsToSameLocation', function (request, response) {
response.end('r1r2');
});
app.get('/redirectToRedirectToNotFound', function (request, response) {
response.redirect('/redirectToNotFound');
});
app.get('/timeout', function (request, response) {
// no response
});
app.get('/internalServerError', function (request, response) {
response.status(500).end();
});
app.get('/page1', function (request, response) {
response.end('Page1Page2Page3NotFoundredirectToRedirectToNotFound');
});
app.get('/page2', function (request, response) {
response.end('Page1Page2Page3NotFoundredirectToRedirectToNotFound');
});
app.get('/page3', function (request, response) {
response.end('Page1Page2Page3NotFoundredirectToRedirectToNotFound');
});
app.get('/page4', function (request, response) {
response.end('redirectToRedirectToNotFound');
});
let server = app.listen(8080, function () {
const host = 'localhost';
const port = server.address().port;
console.log('Testing server listening at http://%s:%s', host, port);
});