Giter Club home page Giter Club logo

disqusjs-proxy-example's Introduction

disqusjs-proxy-example

一个使用 ZEIT Now 部署 Disqus API Proxy 的示例。

简介

ZEIT Now 提供 Serverless 部署服务,支持包括静态网页、微服务、Lambda、持续集成等。在这里我们使用 Now 的微服务功能部署一个 Disqus API 的反代。

DisqusJS 中提供的公共 Disqus API 反代就部署在 ZEIT Now 上。

使用教程

  1. fork 这个 repo
  2. ZEIT 上注册账号并绑定 GitHub 账号
  3. GitHub APP 中为 Now 设置你 fork 后的 repo 的访问权限
  4. 在你 fork 后的 repo 中修改 _now.json 的相关内容
  • 如果你想要绑定你自己的域名,请将 _now.json[Place Your Domain Here] 改成你的域名,否则你可以将整个 alias 字段删除
  • 如果不配置自己的域名,你也可以使用 ZEIT 提供的 now.sh 子域名
  • [Cache Age] 修改为缓存时长(数字),单位是秒。如果你并不需要设置 Cache-Control 响应头,你可以将 routes.headers 字段删除
  • 如果你想要定制其它内容(如添加响应头),请参阅 ZEIT 的相关文档
  1. _now.json 重命名为 now.json 并提交 commit
  2. ZEIT 会自动开始部署你的项目,当部署完成后,ZEIT 的 Bot 会在你的 commit 中添加一条评论提示部署结果
  3. 如果你绑定了你自己的域名,需要添加一条 CNAME 记录指向 alias.zeit.co
  4. 测试你的反代是否可以使用:访问你的反代域名,应该会跳转到 Disqus API 文档页面

因为直接访问 https://disqus.com/api/ 便会跳转到 https://disqus.com/api/docs/ ;反代也会返回 3xx 状态码

  1. 修改你的服务中 Disqus API Endpoint 的配置;如果你正在使用 DisqusJS,这个配置是 DisqusJS 中的 api 字段。

注意事项

  • ZEIT 提供永久免费的 Plan,但是有 100GB 的流量限制
  • ZEIT 实例中的 now.sh 域名会使用 Cloudflare 的 Enterprise Plan;但是你绑定的自己的域名只能使用 ZEIT 自有的基础设施,如有必要可以在 Now 实例之外套一层 CDN

disqusjs-proxy-example's People

Contributors

hans362 avatar sukkaw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.