Skip to content

Commit

Permalink
Switches to using cwd for static
Browse files Browse the repository at this point in the history
Updates ReadMe
  • Loading branch information
Marak committed Apr 19, 2022
1 parent 1dc896a commit ade7439
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ After downloading My Buddy, double click the application. This will start My Bud

You can start using Buddy Pond by visiting `https://localhost`

*Note: It's best to run `mybuddy` from the Terminal or Command Prompt if possible.*

## Compile My Buddy From source

Would rather just run the source? Awesome!
Expand Down
14 changes: 7 additions & 7 deletions bin/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ var privateKey = fs.readFileSync(path.resolve(__dirname + '/../sslcert/key.pem'
var certificate = fs.readFileSync(path.resolve(__dirname + '/../sslcert/certificate.pem'), 'utf8');
var credentials = {key: privateKey, cert: certificate};

let buddyPondPath = path.resolve(__dirname + "/../buddypond")
let appStorePath = path.resolve(__dirname + "/../buddypond-appstore");
let buddyPondPath = path.join(process.cwd(), 'buddypond');
let buddyPondAppStorePath = path.join(process.cwd(), 'buddypond-appstore');

const util = require('util');

Expand All @@ -32,13 +32,13 @@ const util = require('util');
limit: '12mb'
}));

console.log('Mounting appStorePath HTTP path', appStorePath);
app.use('/desktop/apps', express.static(appStorePath));
console.log('Mounting buddyPondAppStorePath HTTP path', buddyPondAppStorePath);
app.use('/desktop/apps', express.static(buddyPondAppStorePath));
console.log('Mounting static HTTP path', buddyPondPath);
app.use(express.static(buddyPondPath, {
extensions: ['html', 'htm']
}));

app.use(function(req, res){
// 404 handler
res.end('My Buddy could not find the Buddy Pond source code! There should be a folder named `buddypond` in the same place you started My Buddy from.');
Expand All @@ -47,8 +47,8 @@ const util = require('util');
var httpServer = http.createServer(app);
var httpsServer = https.createServer(credentials, app);

httpServer.listen(80, () => console.log(`Buddy Pond HTTP Server listening on port 80`));
httpsServer.listen(443, () => console.log(`Buddy Pond HTTPS Server listening on port 443`));
httpServer.listen(80, () => console.log(`HTTP Server Started on port 80`));
httpsServer.listen(443, () => console.log(`Buddy Pond is ready. Visit: https://localhost`));
});

})();

0 comments on commit ade7439

Please sign in to comment.