Skip to content

Commit

Permalink
update:adding azure production script
Browse files Browse the repository at this point in the history
  • Loading branch information
KeziaWahome committed Jan 3, 2024
1 parent 7881427 commit e8f339c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"scripts": {
"generate-swagger": "swagger-jsdoc -d swagger.js -o swagger.json"

},
"devDependencies": {}
}
18 changes: 9 additions & 9 deletions api/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ import Comment from "./models/Comment.js";
import VotingRoutes from "./VotingRoutes.js";
import swaggerUi from 'swagger-ui-express';
import { swaggerSpec } from './swagger.js';
import path from 'path';

const path = require ('path')

const secret = 'secret123';
const app = express();
Expand All @@ -194,15 +194,15 @@ app.use(cors({
credentials: true,
}));

// // adding production script for deployment
// app.use(express.static("./client/build"));
// app.get("*",(req,res) => {
// res.sendFile(path.resolve(__dirname , "client","build" , "index.html"))
// })

// production scrpit on
// Serve static files from the "client/build" directory
app.use(express.static(path.resolve(__dirname, 'client', 'build')));

// production scrpit one
// For serving static files from the 'client/build' directory
const currentModuleURL = new URL(import.meta.url);
const currentModuleDir = path.dirname(currentModuleURL.pathname);

app.use(express.static(path.resolve(currentModuleDir, 'client', 'build')));


app.use(VotingRoutes);

Expand Down

0 comments on commit e8f339c

Please sign in to comment.