Skip to content

Instantly share code, notes, and snippets.

@bmorelli25
Created June 24, 2017 15:45
Show Gist options
  • Save bmorelli25/e527963fead8842c190ad2f6f03afb2d to your computer and use it in GitHub Desktop.
Save bmorelli25/e527963fead8842c190ad2f6f03afb2d to your computer and use it in GitHub Desktop.
weather website with node
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<link rel="stylesheet" type="text/css" href="/css/style.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container">
<fieldset>
<form action="/" method="post">
<input name="city" type="text" class="ghost-input" placeholder="Enter a City" required>
<input type="submit" class="ghost-button" value="Get Weather">
</form>
<% if(weather !== null){ %>
<p><%= weather %></p>
<% } %>
<% if(error !== null){ %>
<p><%= error %></p>
<% } %>
</fieldset>
</div>
</body>
</html>
@nankoyel
Copy link

nankoyel commented Mar 3, 2019

I had to use following code to make this work:

   <% if(typeof weather != "undefined" ){ %>
      <p><%= weather %></p>
    <% } %>

    <% if(typeof error !== "undefined"){ %>
      <p><%= error %></p>
    <% } %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment