Code Monkey home page Code Monkey logo

Comments (9)

mbleigh avatar mbleigh commented on June 2, 2024

Note that this requires a new route parsing rule: colon-based segments. We can talk about this more, but basically need to be able to redirect segments dynamically and this is the best way I can think to do it. Open to comment.

from superstatic.

scottcorgan avatar scottcorgan commented on June 2, 2024

What do you mean by "segments"?

from superstatic.

mbleigh avatar mbleigh commented on June 2, 2024

URL segments. So :name matches an entire URL segment and can be used in the destination.

e.g. {"/some/:path/here":"/other/:path"} matches /some/thing/here and redirects to /other/thing

from superstatic.

scottcorgan avatar scottcorgan commented on June 2, 2024

That makes sense. I already have a module that will make those segments very easy.

Recommendations:

  1. I recommend we use the "routes" object for redirects. It already handles redirects and it's one less config object in the json file.
  2. I recommend we configure status codes like this:
{
  "routes": {
    "/some/path": {
      "status": "302",
      "path": "/some/other/path/redirectied"
    }
  }
}

This makes less confusion as to where the status and the path go in the array for the user.

from superstatic.

mbleigh avatar mbleigh commented on June 2, 2024

We already handle redirects in the routing? I thought it was only rewrites. How do redirects currently work in routes?

from superstatic.

scottcorgan avatar scottcorgan commented on June 2, 2024

I lied. The only redirects that happen are for clean urls and directory indexes. We should add a redirects object.

from superstatic.

mbleigh avatar mbleigh commented on June 2, 2024

Yeah, and you're right it should be plural since routes is plural.

from superstatic.

scottcorgan avatar scottcorgan commented on June 2, 2024

NOTE: providing a url redirects to that url. Providing a path, redirects only to that path

from superstatic.

mbleigh avatar mbleigh commented on June 2, 2024

Let's do status, not statusCode. For one thing, we have generally used an underscore convention for Superstatic config, for another it's more succinct and I like it better.

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.