Skip to content

trying to set this up on my server #1

@micuat

Description

@micuat

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions