Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
E
eth-landing-page
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Erick Hitter
eth-landing-page
Commits
fc783208
Verified
Commit
fc783208
authored
Dec 25, 2016
by
Erick Hitter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handlebars for templating
parent
6e8cda57
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
6 deletions
+40
-6
index.js
index.js
+30
-5
package.json
package.json
+2
-1
render/index.handlebars
render/index.handlebars
+1
-0
render/templates/main.handlebars
render/templates/main.handlebars
+7
-0
No files found.
index.js
View file @
fc783208
'
use strict
'
;
var
express
=
require
(
'
express
'
);
var
wpapi
=
require
(
'
wpapi
'
);
var
app
=
express
();
// Libraries and other setup
var
express
=
require
(
'
express
'
);
var
wpapi
=
require
(
'
wpapi
'
);
var
handlebars
=
require
(
'
express-handlebars
'
);
var
app
=
express
();
// Only one route
app
.
set
(
'
view engine
'
,
'
handlebars
'
);
app
.
engine
(
'
handlebars
'
,
handlebars
(
{
defaultLayout
:
__dirname
+
'
/render/templates/main.handlebars
'
,
partialsDir
:
__dirname
+
'
/render/partials
'
,
layoutsDir
:
__dirname
+
'
/render/templates
'
}
)
);
app
.
set
(
'
views
'
,
__dirname
+
'
/render
'
);
var
domains
=
[
'
https://ethitter.com
'
,
'
https://erick.blog
'
,
'
https://i.ethitter.com
'
];
// Rendering
app
.
get
(
'
/
'
,
function
(
req
,
res
)
{
res
.
send
(
'
Hello World
'
);
res
.
render
(
'
index
'
,
domains
);
}
);
// Get some data
app
.
get
(
'
/api
'
,
function
(
req
,
res
)
{
res
.
status
(
400
).
send
(
{
error
:
'
Must specify a domain!
'
}
);
}
);
app
.
get
(
'
/api/:domain
'
,
function
(
req
,
res
)
{
res
.
json
(
{
'
d
'
:
req
.
params
.
domain
}
);
}
);
// Listen on some random, unused port
...
...
package.json
View file @
fc783208
...
...
@@ -15,7 +15,8 @@
},
"dependencies"
:
{
"
express
"
:
"
*
"
,
"
wpapi
"
:
"
*
"
"
wpapi
"
:
"
*
"
,
"
express-handlebars
"
:
"
*
"
},
"repository"
:
{
"type"
:
"git"
,
...
...
render/index.handlebars
0 → 100644
View file @
fc783208
{{!< main}}
\ No newline at end of file
render/templates/main.handlebars
0 → 100644
View file @
fc783208
<
!
DOCTYPE
>
<html>
<head>
<title></title>
</head>
<body></body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment