@abeai/node-short-url 中文文档教程
node-short-url
用于 node.js 应用程序的 URL 缩短器。 支持多个后端。
Interface
Promise shorten(url[, opts])
使用请求的后端缩短 URL。
opts
backendType
String
- Provide a backend type to use or override
process.env.NODE_SHORT_URL_BACKEND
.
- Provide a backend type to use or override
backendOptions
Object
- Backend specific options to use for short url generation.
Environment Variables
- NODESHORTURL_BACKEND
- Define the short url backend to use. Can override with
opts.backendType
.
- Define the short url backend to use. Can override with
Backends
Firebase
https://firebase.google.com/docs/reference/dynamic-links/link-shortener
通过 Firebase 的 API 创建动态链接。 选项以 dynamicLinkInfo
JSON 格式提供。
Default Options
- suffix.option
- Defaults to
SHORT
.
- Defaults to
Required Environment Variables
- NODESHORTURLFIREBASEDOMAIN
- NODESHORTURLFIREBASEAPI_KEY
- Can pass
backendOptions.key
to override.
- Can pass
node-short-url
URL shortener for usage with node.js applications. Supports multiple backends.
Interface
Promise shorten(url[, opts])
Shorten a URL using the requested backend.
opts
backendType
String
- Provide a backend type to use or override
process.env.NODE_SHORT_URL_BACKEND
.
- Provide a backend type to use or override
backendOptions
Object
- Backend specific options to use for short url generation.
Environment Variables
- NODESHORTURL_BACKEND
- Define the short url backend to use. Can override with
opts.backendType
.
- Define the short url backend to use. Can override with
Backends
Firebase
https://firebase.google.com/docs/reference/dynamic-links/link-shortener
Create dynamic links via Firebase's API. Options are provided in the dynamicLinkInfo
JSON format.
Default Options
- suffix.option
- Defaults to
SHORT
.
- Defaults to
Required Environment Variables
- NODESHORTURLFIREBASEDOMAIN
- NODESHORTURLFIREBASEAPI_KEY
- Can pass
backendOptions.key
to override.
- Can pass
更多