Code Monkey home page Code Monkey logo

Comments (4)

scottcorgan avatar scottcorgan commented on June 11, 2024

Hierarchy

  1. routes
  • exact
  • glob with extension
  • glob
    1. clean url
    2. is directory, server index.html
    3. server static files

Need to load into route map:

  • static file path (/somedir/index.html, 301 redirects to directory /somedir route)
  • clean url file path (/somedir/index, 301 reidrects to directory /somedir route))
  • directory served as index.html file path (/somedir servers /somedir/index.html)

from superstatic.

scottcorgan avatar scottcorgan commented on June 11, 2024

From Michael

  1. request comes in. if path matches exactly to a static file, and doesn't end in .html (or pretty urls are off) serve the file
  2. if pretty urls are on and the path matches exactly to a file with '.html', 301 redirect to the same path with '.html' dropped
  3. if pretty urls are on and the path matches to a file without '.html', serve up that file
  4. if path matches to a file after adding "/index.html" to it, serve the index file
  5. if any custom routes are declared, iterate through them and run a regex match against the path if a match, serve the file specified by the route
  6. 404 because we haven't found anything else

from superstatic.

scottcorgan avatar scottcorgan commented on June 11, 2024

priority is:

  1. exact file match
  2. custom route match
  3. index file match
  4. pretty url match

from superstatic.

scottcorgan avatar scottcorgan commented on June 11, 2024

path description: https://gist.github.com/mbleigh/0ea027bb2db04bfcc4ce

from superstatic.

Related Issues (20)

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.