URL Shortener - Global Variables Help

Hey y’all,
I want my app.post to change these global variables when activated:

var random = 0;
var original = "";

It’s not working and I have no idea why. Can you not change global variables inside of the app function?

Here is the link:

Any help is greatly appreciated!

Cheers :+1:

@bstefansen If you enter a url into the form, does your else statement code block (below) even execute?

    } else {
      random = Math.floor(Math.random() * 1000 + 1);
      original = req.body.URL;
      res.json({
        original_url: original,
        short_url: random
      });
    }

That’s weird. It was previously, but now it only returns the error json :frowning: