forked from DigitalProductschool/dps-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
73 lines (66 loc) · 4.17 KB
/
index.js
File metadata and controls
73 lines (66 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
window = {};
const express = require('express');
const router = express.Router();
const React = require('react');
const ReactDOMServer = require('react-dom/server');
const frontend = require('./frontend/dist/bundle-server');
const buildhash = require('./frontend/dist/buildhash');
const StaticRouter = require('react-router-dom').StaticRouter;
/* GET home page. */
router.get('/', function(req, res, next) {
const element = React.createElement(StaticRouter, { location: req.url, context: {} }, React.createElement(frontend.App));
const reactDOM = ReactDOMServer.renderToString(element);
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(htmlTemplate(reactDOM, frontend.css));
});
function htmlTemplate(reactDom, css) {
return `
<!DOCTYPE html>
<html>
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5HGJ5CL');</script>
<!-- End Google Tag Manager -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Digital Product School</title>
<meta name="description" content="DPS is a 3 months training program where product managers, interaction designers, software engineers and AI-specialists build innovative digital products.">
<meta property="og:title" content="Apply now for DPS and become an experienced digital product maker!" />
<meta property="og:description" content="DPS is a 3 months training program where product managers, interaction designers, software engineers and AI-specialists build innovative digital products."/>
<meta property="og:type" content="website" />
<meta property="og:url" content="https://digitalproductschool.io" />
<meta property="og:site_name" content="dp.school" />
<meta property="og:image" content="https://digitalproductschool.io/assets/shared/link_dps.jpg" />
<meta property="og:image:secure_url" content="https://digitalproductschool.io/assets/shared/link_dps.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="Apply now for DPS and become an experienced digital product maker!" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@dpschool_io" />
<meta name="twitter:title" content="Apply now for DPS and become an experienced digital product maker!" />
<meta name="twitter:description" content="DPS is a 3 months training program where product managers, interaction designers, software engineers and AI-specialists build innovative digital products." />
<meta name="twitter:image" content="https://digitalproductschool.io/assets/shared/dps-square.png" />
<meta name="twitter:creator" content="@dpschool_io" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel=“canonical” href=“https://digitalproductschool.io/” />
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,800" rel="stylesheet">
<link rel="icon" type="image/png" href="/assets/favicon.png" />
<style> ${css} </style>
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGJ5CL"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div id="app"> ${reactDom} </div>
<script type="text/javascript" src="dist/bundle.${buildhash}.js"></script>
</body>
</html>
`;
}
module.exports = router;