sudiptog81 / mlh-orihack-backend

Backend for OriHack
https://github.com/sudiptog81/mlh-orihack
0 stars 0 forks source link

Serve frontend with Express #4

Closed sudiptog81 closed 3 years ago

sudiptog81 commented 3 years ago

As we will be using cookies from passport, it might as well be nice to serve the production build from express.

const express = require('express');
const history = require('connect-history-api-fallback');

const app = express();
app.use(history());

// all other routes

app.use(express.static('src'));

app.get('/', (req, res) => {
  res.sendFile('../frontend/dist/index.html');
});

app.listen(3000, () => console.log('server started'));
desirekaleba commented 3 years ago

Working on it.

sovoid commented 3 years ago

@sudiptog81 Would this require us to have a single repo?

sudiptog81 commented 3 years ago

@sudiptog81 Would this require us to have a single repo?

No, the frontend repo shall remain separate. For development, clone the frontend repo in the same directory under which you have cloned the backend repo. All of the code has been organised as submodules under sudiptog81/mlh-orihack.