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

Add http docs, support https #161

Merged
merged 6 commits into from
Oct 8, 2024
Merged

Add http docs, support https #161

merged 6 commits into from
Oct 8, 2024

Conversation

jonnyz32
Copy link
Collaborator

@jonnyz32 jonnyz32 commented Oct 4, 2024

  • This pr adds support and documentation for https destinations as well as improving existing support for http
    This pr can be tested by spinning up a local express server and routing messages there.

Here is one such example of an express server that can be used

const express = require('express');
const fs = require('fs');
const path = require('path');
const https = require('https');
const app = express();
app.use(express.json()); // For JSON bodies

// Middleware to log requests
const options = {
    key: fs.readFileSync(path.join(__dirname, 'localhost-key.pem')),
    cert: fs.readFileSync(path.join(__dirname, 'localhost.pem'))
}
app.use((req, res, next) => {
  console.log(`${req.method} ${req.url} ${JSON.stringify(req.body)}`);
  next();
});

// Example route
app.get('/', (req, res) => {
  res.send('Hello World!');
});

app.post('*', (req, res) => {
    res.send('Hello World!');
  });

const server = https.createServer(options, app)
// Start the server
server.listen(3000, () => {
  console.log('Server is listening on port 3000');
});

@jonnyz32 jonnyz32 marked this pull request as ready for review October 4, 2024 20:33
Copy link
Collaborator

@SanjulaGanepola SanjulaGanepola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works. Thanks

@SanjulaGanepola SanjulaGanepola merged commit a981da3 into main Oct 8, 2024
2 checks passed
@SanjulaGanepola SanjulaGanepola deleted the test-http branch October 8, 2024 15:13
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

Successfully merging this pull request may close these issues.

2 participants