Created
October 20, 2020 05:20
-
-
Save theabbie/a33304b4b815d1ce5e6593cd3f5b339d to your computer and use it in GitHub Desktop.
Random DevRant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = require('express')(); | |
var axios = require('axios'); | |
app.get("/*", async function(req,res) { | |
try { | |
var rants = (await axios("https://del.dog/raw/rants")).data.split("\n"); | |
var rant = rants[Math.floor(Math.random()*rants.length)]; | |
res.redirect(307,"https://devrant.com/rants/"+rant); | |
} | |
catch (e) { | |
res.end(e.message); | |
} | |
}) | |
app.listen(process.env.PORT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment