npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

forward-deeplink

v0.1.0

Published

This repo fork of node-deeplink, Easily create an endpoint in your web server that redirects deep links to mobile apps

Downloads

56

Readme

forward-deeplink Build Status styled with prettier

Easily create express endpoint to handle mobile deeplinks in your web server

Takes away the pain of forwarding users to the right app store / mobile app depending on their platform.

Use case

Suppose you have a custom url scheme app:// handled by your mobile apps. You want to create a universal "smart" link that will know where to send the user:

  • If the user has the app installed, open the app with the deeplink.
  • If the user doesn't have the app installed, send to the app store to download the app (google play / itunes).
  • If the user doesn't have a supported phone, send to a fallback url.

Usage

Example:

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

var app = express();

// fix deeplink conf with constance values
app.get(
  '/deeplink',
  deeplink({
    fallback: 'https://cupsapp.com',
    android_package_name: 'com.linh.demo',
    ios_store_link: 'https://itunes.apple.com/us/app/myapp/id556462755',
  })
);

// attach deeplink configurations inner request query-string
app.get('/forward-deeplink', deeplink());

This example creates an endpoint GET /deeplink in your web server.

Assuming your server address is https://acme.org, you can use the link https://acme.org/deeplink?url=app://account so when users will open it the app will open with app://account deeplink or the users will be redirected to download the app in case they don't have it.

Available options

forward-deeplink currently only supports Android and ios.

Options 1: To pass on to forward-deeplink are:

  • url: mandatory. The deeplink url you want the user to be directed to e.g. app://account.
  • fallback: mandatory. A fallback url in case the user is opening the link via an unsupported platform like desktop / windows phone etc. In such case, the fallback url will be opened in the user's browser like a normal link.
  • android_package_name: optional. In case you want to support Android deep links, pass your app's package name.
  • ios_store_link: optional. In case you want to support ios deep links, pass your app's itunes url. You can get it here.
  • title: optional. Title for the intermediate html page. Defaults to an empty string.

Options 2: To pass on to query params (express request):

When a request comes in, the following query params are checked:

  • url: mandatory. If available, will prefer this deeplink url over the one from the options.
  • fallback: mandatory. If available, will prefer this fallback address over the one from the options.
  • android_package_name: optional. In case you want to support Android deep links, pass your app's package name.
  • ios_store_link: optional. In case you want to support ios deep links, pass your app's itunes url. You can get it here.
  • title: optional. Title for the intermediate html page. Defaults to an empty string.

Behaviour

forward-deeplink works by first sending the user to an html page with a user-agent sniffing script. After figuring out the user's device, it redirects them to the predefined deeplink. In practice, after clicking the link, the browser will be opened for a very short moment and then the redirect will happen.

TODO

  • Better user-agent discovery.
  • Enable non-express use.