Guest User

Untitled

a guest
Dec 9th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. const express = require('express');
  2. const app = express();
  3. const layout = require('./layout');
  4. const { PageMapper } = require('web-components-node');
  5. const pageMapper = new PageMapper('app/pages');
  6.  
  7. // Page route
  8. app.get('/*', async (req, res) => {
  9. const { body, title } = await pageMapper.findPage(req.path)();
  10. res.send(layout({ body, title }));
  11. });
  12.  
  13. app.listen('3001', () => console.log(`Example app running on port 3001`));
Add Comment
Please, Sign In to add comment