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