blogv3/app.js
// Send the "new post" page, with an error message if needed
Send the "new post" page, with an error message if needed
Send the " new post " page with an error message if needed
function newPost(res, message)
    {
      var s = "<title>New Post</title>\n";
      s += "<h1>My Blog</h1>\n";
      s += "<h2>New Post</h2>\n";
      if (message)
      {
        s += "<h3>" + message + "</h3>\n";
      }
      s += '<form method="POST" action="/new">' + "\n";
      s += 'Title: <input name="title" /> <br />' + "\n";
      s += '<textarea name="body"></textarea>' + "\n";
      s += '<input type="submit" value="Post It!" />' + "\n";
      s += "</form>\n";
      res.send(s);
    }
function newPost ( res , message ) { var s = "<title>New Post</title>\n" ; s += "<h1>My Blog</h1>\n" ; s += "<h2>New Post</h2>\n" ; if ( message ) { s += "<h3>" + message + "</h3>\n" ; } s += '<form method="POST" action="/new">' + "\n" ; s += 'Title: <input name="title" /> <br />' + "\n" ; s += '<textarea name="body"></textarea>' + "\n" ; s += '<input type="submit" value="Post It!" />' + "\n" ; s += "</form>\n" ; res . send ( s ) ; }
Send the "new post" page, with an error message if needed
Send the " new post " page with an error message if needed