Is currently..err, glitched?

I am currently at Api & microservices test number 3 : url shortener. Since this test requiring a form to submit the url, this is my form code:

<form method="POST" action="/api/shorturl/new/">
  Your URL:<br>
  <input type="text" name="myUrl" value="">
  <input type="submit" value="Submit">

The problem is : everytime i pressed the form submit button, it take a very long for the glitch page to process that simple request, and when it is done, the result is always a big capital message : Site didn’t respond.

So, any help? Anyone else currently experiencing this?

you need to write code inside else statement for response i.e.'/api/shorturl/new', (req, res)=>{
  const {myUrl} = req.body;
    res.json({error: 'invalid URL'});
    dns.lookup(myUrl, function (err, address, family) {
        res.json({error: 'invalid Hostname'});
        //Model.find here....
        res.json({success:"working fine"})
1 Like

Ahh, yes, basically have to handle the response for every conditional branch. Thank you again!

Hello, sorry to bother you again, if you have the time please have a look at this question