Skip to content

Instantly share code, notes, and snippets.

@imkost
Last active November 3, 2016 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imkost/3cf9edbd10f8a4639aaf2d7fb31d1ee5 to your computer and use it in GitHub Desktop.
Save imkost/3cf9edbd10f8a4639aaf2d7fb31d1ee5 to your computer and use it in GitHub Desktop.
function server(req, res) {
return res.end(App({ url: req.url }));
}
function App({ url }) {
return `
<!doctype html>
<html class="app">
<head>
<meta charset="utf-8" />
<title>Slender Website</title>
</head>
<body class="app__body">
${Header()}
${(
url === '/' ? 'This is MAIN page' :
url === '/about' ? 'This is ABOUT page' :
url === '/contacts' ? 'This is CONTACTS page' :
'This is 404 page'
)}
</body>
</html>
`;
}
function Header() {
return `
<div class="header">
<a class="header__link" href="/">Main</a>
<a class="header__link" href="/about">About</a>
<a class="header__link" href="/contacts">Contacts</a>
</div>
`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment