Files
freeCodeCamp/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice.md

38 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: bd7158d8c443edefaeb5bd0e
title: 短网址
challengeType: 4
forumTopicId: 301509
---
# --description--
构建一个功能类似于 <https://thread-paper.glitch.me/> 的 JavaScript 全栈应用。
在开发这个项目时,我们推荐你在 [Glitch](https://glitch.com/) 上编码。编码完成之后,你可以把应用主页的链接复制到屏幕的输入框中,测试你的代码是否能通过项目需求。当然你也可以基于其他的平台来完成自己的项目,只要提供一个公开的主页便于我们测试就行。
参考示例:你可以通过 [这个链接](https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-urlshortener/) 访问在 Glitch 上的项目,或者从 GitHub 上 clone [这个仓库的代码](https://github.com/freeCodeCamp/boilerplate-project-urlshortener/)。如果你使用 Glitch请记住将项目链接保存到妥当的地方。
# --hints--
当我传入一个 url 作为参数时我将在JSON响应中收到缩短的URL。
```js
```
如果我传入一个无效的链接,则会返回一个包含 “没有遵循如 `http://www.example.com` 的有效格式” 的错误信息的 JSON 响应。
```js
```
当我访问这个短 URL 时, 将重定向到我原来的链接。
```js
```
# --solutions--