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

hyco-https wouldn't work with express #54

Open
farehar opened this issue May 4, 2020 · 2 comments
Open

hyco-https wouldn't work with express #54

farehar opened this issue May 4, 2020 · 2 comments

Comments

@farehar
Copy link

farehar commented May 4, 2020

Sample code:

var ns = "frtestrelay.servicebus.windows.net"; // fully qualified relay namespace
var path = "test";
var keyrule = "all"; // name of a SAS rule
var key = ""; // key of the SAS rule

const http = require('http');
const https = require('hyco-https');
http.ServerResponse = https.ServerResponse;

const express = require('express');
var app = express();

var uri = https.createRelayListenUri(ns, path);
var server = https.createRelayedServer(
{
server : uri,
token : () => https.createRelayToken(uri, keyrule, key)
},
app
);

app.get('/my', function (req, res) {
console.log('received');
res.status(200).send('hey');
});

server.listen();

Actual Behavior

  1. Calling the endpoint(GET frtestrelay.servicebus.windows.net/test/my) fails with error:
<title>Error</title>
Cannot GET /test/my

Expected Behavior

  1. Server should receive the request

Versions

  • OS platform and version:
    Windows 10 18363.778
  • Node Version:
    v10.16.3
  • NPM package version or commit ID:
    Express Version: express@4.17.1
    hyco-https version: hyco-https@1.4.4
@vsundesha-bond
Copy link

Any update on this issue?

@diegohexi
Copy link
Contributor

diegohexi commented Nov 27, 2020

@farehar @vsundesha-bond

You need to prepend the ${path} variable on all your endpoints.

app.get('/test/my', ...);
app.get('/test/otherendpoints', ...);

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

No branches or pull requests

6 participants