pbplus-cognito-sdk
Version:
AWS Cognito login flow sdk for PBPlus.
30 lines (27 loc) • 852 B
JavaScript
// index.js
;
import Express from 'express';
const isProd = process.env.NODE_ENV === 'production';
const WEB_PORT = process.env.PORT || 3000;
const expressStaticRoutes = [
{path: '/js/', serverPath: '/../client'},
];
const renderApp = `
<!doctype html>
<html>
<head>
<title>pbplus-cognito-sdk-demo</title>
</head>
<body>
<div id="app-root"></div>
<script type='text/javascript' src="${isProd ? `/js/bundle.js` : `http://localhost:7000/bundle.js`}" ></script>
</body>
</html>
`;
const app = Express();
app.get('/', (req, res) => { res.send(renderApp); })
app.get('/:arg', (req, res) => { res.send(renderApp); })
expressStaticRoutes.forEach(function(route) {
app.use(route.path, Express.static(__dirname + route.serverPath));
});
app.listen(WEB_PORT);