Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const expre = require('express');
- const bodyParser = require('body-parser');
- const path = require('path');
- const api = require('./routes/api');
- const { mongoose } = require('./db');
- let app = expre();
- app.use(expre.static(path.join(__dirname, 'dist')));
- app.use(bodyParser.urlencoded({ extended: true }));
- app.use(bodyParser.json());
- app.use('/api', api);
- app.get('*', (req, res) => {
- res.sendFile('index.html', { root: path.join(__dirname, 'public') });
- });
- app.listen(3000, () => console.log("server started successfully...."));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement