Skip to content

Commit

Permalink
Merge pull request #137 from hammer-io/nathandegraaf-beautify
Browse files Browse the repository at this point in the history
added index.html page to expressjs
  • Loading branch information
jackcmeyer authored Nov 27, 2017
2 parents 16f69b6 + b4bdb0f commit 043e80e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export default {
index: {
fileName: 'index.js'
},
indexHTML: {
fileName: 'index.html'
},
routes: {
fileName: 'routes.js'
}
Expand Down
4 changes: 4 additions & 0 deletions src/utils/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ export function createJsFiles(folderName) { // eslint-disable-line import/prefer
`${folderName}/src/${constants.express.routes.fileName}`,
loadTemplate('./../../templates/js/express/routes.js')
);
writeFile(
`${folderName}/src/${constants.express.indexHTML.fileName}`,
loadTemplate('./../../templates/js/express/index.html')
);
}
39 changes: 39 additions & 0 deletions templates/js/express/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="manifest" href="/manifest.json">
<title>Your Hammer app</title>
<style type="text/css">body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
</style><style type="text/css">.App {
text-align: center;
}

.App-logo {
height: 120px;
}

.App-header {
background-color: #222;
height: 200px;
padding: 20px;
color: white;
}

.App-title {
font-size: 1.5em;
}

.App-intro {
font-size: large;
}

</style></head>
<body>
<div id="root"><div class="App"><header class="App-header"><img src="https://hammer-io.github.io/i/Viking_Hammer_Logo_1.png" class="App-logo" alt="logo"><h1 class="App-title">Hello World!</h1></header><p class="App-intro">Welcome to your new app created through <a href="https://github.com/hammer-io">hammer-io<a>.</p></div></div>

</body>
2 changes: 1 addition & 1 deletion templates/js/express/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ module.exports = router;

// Example endpoint
router.get('/', function (req, res) {
res.send('Hello World');
res.sendFile(__dirname + '/index.html');
});

0 comments on commit 043e80e

Please sign in to comment.