Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trying to set this up on my server #1

Open
micuat opened this issue Jul 6, 2024 · 0 comments
Open

trying to set this up on my server #1

micuat opened this issue Jul 6, 2024 · 0 comments

Comments

@micuat
Copy link
Member

micuat commented Jul 6, 2024

I'm trying to get the backend + latest frontend working

first I had to edit backend/server.js (mostly edits for https. the last line was needed to adapt to vite)

diff --git a/backend/server.js b/backend/server.js
index 45b44cb..5781d39 100755
--- a/backend/server.js
+++ b/backend/server.js
@@ -7,7 +7,11 @@ var cors = require('cors')
 
 const app = express()
 const path = require('path')
-var http = require('http')
+var http = require('https')
+
+var privateKey = fs.readFileSync(path.join(__dirname, '/certs/key.pem'), 'utf8')
+var certificate = fs.readFileSync(path.join(__dirname, '/certs/certificate.pem'), 'utf8')
+var credentials = {key: privateKey, cert: certificate}
 
 const corsOptions = {
   origin: ['https://hydra.ojack.xyz'],
@@ -17,7 +21,7 @@ const corsOptions = {
 
 app.use(cors(corsOptions))
 
-var server = http.createServer(app)
+var server = http.createServer(credentials, app)
 //
 // TURN server access
 var twilio = require('twilio')
@@ -102,4 +106,4 @@ app.use('/garden', express.static(path.join(__dirname, '../frontend/hydra-garden
 app.use('/grants', express.static(path.join(__dirname, '../frontend/hydra-grants/public')))
 
 
-app.use(express.static(path.join(__dirname, '../frontend/web-editor/public')))
+app.use(express.static(path.join(__dirname, '../frontend/web-editor/dist')))

then I swapped frontend/web-editor with the latest hydra repository. There I used yarn build to build the source using vite. Back in the hydra-server folder, I used yarn serve and it seems the server is working with the latest frontend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant