node-url-shortener:用 node.js 编写的一个简单的内存中 URL 缩短服务

时间:2024-07-16 09:11:09
【文件属性】:

文件名称:node-url-shortener:用 node.js 编写的一个简单的内存中 URL 缩短服务

文件大小:3KB

文件格式:ZIP

更新时间:2024-07-16 09:11:09

JavaScript

一个用 node.js 编写的简单的内存中 URL 缩短服务。 跑步 运行npm start或node main.js来启动服务器监听 3000 端口。可以在 PORT 环境变量中指定自定义端口。 用法 使用 URL 作为link参数 POST /shorten。 返回一个短 id,稍后用于访问 URL。 示例: curl --data "link=https://google.fi/foo/bar?baz&foo" localhost:3000/shorten GET /:id 访问以前缩短的链接。 如果带有 :id 的 URL 存在,则执行 301 重定向,否则返回 404。 版权 任何版权都属于公共领域。


【文件预览】:
node-url-shortener-master
----package.json(209B)
----shortener.js(2KB)
----main.js(724B)
----README.md(682B)

网友评论