GithubHelp home page GithubHelp logo

fireyang / exponent-host Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sco/exponent-host

0.0 2.0 0.0 2.88 MB

The Exponent server that hosts rich articles written with JavaScript and React Native

License: MIT License

HTML 0.68% JavaScript 94.65% CSS 4.67%

exponent-host's Introduction

exponentjs.com Circle CI Slack

This is the Exponent hosting service, which includes the React Native packager cluster and the https://exponentjs.com and https://exp.host websites.

How are things set up?

See QUICKSTART.md for setup instructions.

CDN

Static resources are served from AWS CloudFront, which caches the resources and serves them quickly to users worldwide. The domain of our CloudFront is http://static.exponentjs.com. When you visit one of our CDN URLs that CloudFront doesn't have cached, it retrieves the static resources on-demand from the origin server at https://exponentjs.com/assets.

The filenames of the static resources are generated by webpack and are computed by hashing the resources; this means that a resource's filename and URL don't change unless the resource's content changes. This is great for caching as we don't need to implement cache invalidation and CloudFront and browsers can cache the static resources indefinitely. The origin's response includes Cache-Control headers that tell CloudFront to cache the resources for a sufficiently long time like a year. As an emergency switch, our static resource URLs contain v${version}, where ${version} is a digit that acts as a cache breaker.

So, when you visit http://static.exponentjs.com/v0/pmEUQbj7N1m95nXyF7j7.png the following happens when all caches are empty:

  1. Your client looks for the URL in its local cache, doesn't find it, and makes a request to the server
  2. http://static.exponentjs.com points to CloudFront, which looks up the URL in its cache. CloudFront will ignore HTTP headers and query parameters.
  3. CloudFront constructs the URL to the origin server and makes a request to http://exponentjs.com/assets/v0/pmEUQbj7N1m95nXyF7j7.png
  4. The origin server at http://exponentjs.com routes the request to the asset handler, which serves the file at build/web/assets/pmEUQbj7N1m95nXyF7j7.png. The version part of the path is ignored; it is solely for bypassing CloudFront's cache.

exponent-host's People

Contributors

brentvatne avatar ccheever avatar ide avatar jesseruder avatar nikki93 avatar

Watchers

 avatar  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.