Skip to content

Instantly share code, notes, and snippets.

@AndyNovo

AndyNovo/ssti.js Secret

Created November 12, 2025 13:48
Show Gist options
  • Select an option

  • Save AndyNovo/89498c2faebddc29250f9a23dec55569 to your computer and use it in GitHub Desktop.

Select an option

Save AndyNovo/89498c2faebddc29250f9a23dec55569 to your computer and use it in GitHub Desktop.
/**
* This is the main Node.js server script for your project
* Check out the two endpoints this back-end API provides in fastify.get and fastify.post below
*/
const path = require("path");
var jade = require('jade');
// Require the fastify framework and instantiate it
const fastify = require("fastify")({
// Set this to true for detailed logging:
logger: false
});
// ADD FAVORITES ARRAY VARIABLE FROM TODO HERE
// Setup our static files
fastify.register(require("fastify-static"), {
root: path.join(__dirname, "public"),
prefix: "/" // optional: default '/'
});
// fastify-formbody lets us parse incoming forms
fastify.register(require("fastify-formbody"));
// point-of-view is a templating manager for fastify
fastify.register(require("point-of-view"), {
engine: {
handlebars: require("handlebars")
}
});
/**
* Our home page route
*
* Returns src/pages/index.hbs with data built into it
*/
fastify.get("/", function(request, reply) {
let params = { flag: process.env.SECRET };
reply.view("/src/pages/index.hbs", {server: "arbitrary", channel: "URL"});
});
fastify.get("/:server", function(request, reply) {
let params = { flag: process.env.SECRET };
reply.send(jade.render(request.params.server));
});
console.log("restart sorry kids");
// Run the server and report out to the logs
fastify.listen({ port: 8080, host: '0.0.0.0' }, function(err, address) {
if (err) {
fastify.log.error(err);
process.exit(1);
}
console.log(`Your app is listening on ${address}`);
fastify.log.info(`server listening on ${address}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment