Personal Dashboard

server.js 654B

12345678910111213141516171819202122
  1. import path from 'path';
  2. import Express from 'express';
  3. // initialize the server and configure support for ejs templates
  4. const app = new Express();
  5. app.set('views', path.join(__dirname, 'views'));
  6. // define the folder that will be used for static assets
  7. app.use(Express.static(path.join(__dirname, 'dist')));
  8. // universal routing and rendering
  9. app.get('/user', () => console.log('api call'));
  10. // start the server
  11. const port = process.env.PORT || 3000;
  12. const env = process.env.NODE_ENV || 'production';
  13. app.listen(port, err => {
  14. if (err) {
  15. return console.error(err);
  16. }
  17. console.info(`Server running on http://localhost:${port} [${env}]`);
  18. });