Santosh Khavekar Santosh Khavekar - 1 year ago 107
HTTP Question

How to implement Android Deeplink without express server in node.js

I am trying to integrate Android Deeplink with a HTTP server in node.js. Actually, if I create an end point with express server, like

app.get('/deeplink', deeplink({
fallback: '',
android_package_name: ''

it will work fine. But actually I need to integrate with a normal http server.

Answer Source

Yes I have done my job to work it with HTTP end point.No need to require deep-link instead of just modified deep-link library to use with HTTP middle ware. Posting following code ,hope it will help to someone.Thanks

        var file = fs.createReadStream(path.join(__dirname, '/public/index.html'));
        var options={
            fallback: config.deeplink_fallback,
        var detoken = new stream.Transform({ objectMode: true });   
        detoken._transform = function (chunk, encoding, done) {
            var data = chunk.toString()
            Object.keys(options).forEach(function (key) {
                data = data.replace('{{' + key + '}}', options[key])
        var inline = inliner({ basedir: path.join(__dirname, '/public') }); 
        res.setHeader('Content-Type', 'text/html; charset=utf-8');
        var newdt=file.pipe(detoken).pipe(inline);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download