Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. const expre = require('express');
  2. const bodyParser = require('body-parser');
  3. const path = require('path');
  4. const api = require('./routes/api');
  5. const { mongoose } = require('./db');
  6.  
  7. let app = expre();
  8. app.use(expre.static(path.join(__dirname, 'dist')));
  9. app.use(bodyParser.urlencoded({ extended: true }));
  10. app.use(bodyParser.json());
  11. app.use('/api', api);
  12. app.get('*', (req, res) => {
  13. res.sendFile('index.html', { root: path.join(__dirname, 'public') });
  14. });
  15. app.listen(3000, () => console.log("server started successfully...."));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement