"use strict";
let app = require('express')();
app.get('/', function (request, response) {
response.end([
'
',
' - found
',
' - notFound
',
' - external_link
',
' - deeplink1
',
' - interlinked1
',
' - redirectToFound
',
' - redirectToNotFound
',
' - redirectToNotFound
',
' - redirectLoop
',
' - timeout
',
' - internalServerError
',
' - invalidStatusCode
',
' - twoRedirectsToSameLocation
',
' - mailto
',
' - tel
',
'
',
].join('\n'));
});
app.get('/externalLink', function (request, response) {
response.end('ext');
});
app.get('/deeplink1', function (request, response) {
response.end('l');
});
app.get('/deeplink2', function (request, response) {
response.end('l');
});
app.get('/deeplink3', function (request, response) {
response.end('l');
});
app.get('/deeplink4', function (request, response) {
response.end('l');
});
app.get('/found', function (request, response) {
response.end('this page is found');
});
app.get('/redirectToNotFound', function (request, response) {
response.redirect('/notFound');
});
app.get('/redirectToRedirectToNotFound', function (request, response) {
response.redirect('/redirectToNotFound');
});
app.get('/redirectToFound', function (request, response) {
response.redirect('/found');
});
app.get('/redirectLoop', function (request, response) {
response.redirect('/redirectLoop');
});
app.get('/twoRedirectsToSameLocation', function (request, response) {
response.end('r1r2');
});
app.get('/redirect1', function (request, response) {
response.redirect('/found');
});
app.get('/redirect2', function (request, response) {
response.redirect('/found');
});
app.get('/timeout', function (request, response) {
// no response
});
app.get('/internalServerError', function (request, response) {
response.status(500).end();
});
app.get('/invalidStatusCode', function (request, response) {
response.status(999).end();
});
app.get('/interlinked1', function (request, response) {
response.end('123r');
});
app.get('/interlinked2', function (request, response) {
response.end('123r');
});
app.get('/interlinked3', function (request, response) {
response.end('123r');
});
app.get('/interlinked4', function (request, response) {
response.end('123r');
});
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);
});