Last active
November 3, 2016 20:21
-
-
Save imkost/3cf9edbd10f8a4639aaf2d7fb31d1ee5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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