From 9f41d8dbb8506a182628208d52cf0e290bca754b Mon Sep 17 00:00:00 2001 From: Sevalas Date: Mon, 20 Mar 2023 20:23:03 -0300 Subject: [PATCH] Changes to upload onRender --- .gitignore | 2 ++ server.js | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index e8419902..e40afb84 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,5 @@ testem.log # System Files .DS_Store Thumbs.db + +dist/ \ No newline at end of file diff --git a/server.js b/server.js index 4024451b..df80d3b0 100644 --- a/server.js +++ b/server.js @@ -1,12 +1,18 @@ -const express = require('express'); -const path = require('path'); - +const express = require("express"); +const router = express.Router(); +const path = require("path"); const app = express(); -app.use(express.static('./dist/desafio-accenture-svl')); +const port = process.env.PORT || 8080; + +app.use(express.static("./dist/desafio-accenture-svl")); + +app.use(express.json()); +app.use("/", router); -app.get('/*', (req, res) => - res.sendFile('index.html', {root: 'dist/desafio-accenture-svl/'}), +app.use(express.static(path.join(__dirname, "/dist/desafio-accenture-svl"))); +app.get("*", (req, res) => + res.sendFile(path.join(__dirname, "/dist/desafio-accenture-svl/index.html")) ); -app.listen(process.env.PORT || 8080); \ No newline at end of file +app.listen(port, () => console.log("Server Running"));