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

Please Verify My Code #23

Open
lucassouzamiranda opened this issue Jan 10, 2020 · 2 comments
Open

Please Verify My Code #23

lucassouzamiranda opened this issue Jan 10, 2020 · 2 comments

Comments

@lucassouzamiranda
Copy link

lucassouzamiranda commented Jan 10, 2020

I am trying to pass the request parameter to the URL. But it is returning undefined.


var express = require('express');
var deeplink = require('node-deeplink');

var app = express();

let anuncioId;
app.get(
'/anuncio/:codigo',
function (request, response, next) {
anuncioId = request.params.codigo;
console.log('primeiro ' + anuncioId)
return next();
},
deeplink({
url: detroca.app://detroca/anuncio/${anuncioId},
fallback: 'https://www.detroca.com.br',
android_package_name: 'com.app.detroca',
title: Anuncio: ${anuncioId}
})
);

app.listen(3000);
console.log('deeplink service listening on port 3000');

@lyudad
Copy link

lyudad commented May 6, 2020

Hello. how have you solve it?

@josechavarriacr
Copy link

Hi @lucassouzamiranda and @lyudad,
I had the same problem with you and this is my solution

var express = require('express');
var deeplink = require('node-deeplink');

var app = express();

const setDeeplink = (req, res, next) => {
    const options = {
        url: `detroca.app://detroca/anuncio/${req.params.codigo}`,
        fallback: 'https://www.detroca.com.br',
        android_package_name: 'com.app.detroca',
        title: `Anuncio: ${req.params.codigo}`,
    }
    return deeplink(options)(req, res, next)
}


app.get('/anuncio/:codigo', setDeeplink)

app.listen(3000);
console.log('deeplink service listening on port 3000');

I attached screen expected

image

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

3 participants