Skip to content

Instantly share code, notes, and snippets.

@Athelian
Last active September 21, 2021 13:41
Show Gist options
  • Save Athelian/da4ab9744bf36aed7adfd24ad7f8a38d to your computer and use it in GitHub Desktop.
Save Athelian/da4ab9744bf36aed7adfd24ad7f8a38d to your computer and use it in GitHub Desktop.
Benign frontend server
< !DOCTYPE html >
<html>
<head>
<!-- web crawlers will read this -->
<meta name="og:title" property="og:title" content="<%= title %>" />
<script>
// browser windows will activate this
window.location.href = "<%= redirectUrl %>";
</script>
</head>
</html>
const express = require("express");
const app = express();
const port = process.env.PORT || 8080;
app.set("views", [
"views", // folder in root of project with .html page
// can add new endpoints here
]);
app.set("view engine", "ejs");
app.get('/', function (request, response) {
response.render("news/articles/_article_id", {
// these variables are passed to the .ejs template
redirectUrl: "https://www.my-real-page.com/",
title: "My homepage"
});
});
app.listen(port, () => console.log(`Listening on port ${port}`))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment