Git Product home page Git Product logo

Comments (4)

tipiirai avatar tipiirai commented on May 25, 2024 2

Cool! I think site.yaml is a better place than command line.

from nue.

goblinfactory avatar goblinfactory commented on May 25, 2024 1

@tipiirai Perhaps tag this issue with a label : requires-documentation <-- or similar, and we keep it open until the documentation is updated? (after the PR is merged I mean) Since we can get that in now, and update docs later.

from nue.

goblinfactory avatar goblinfactory commented on May 25, 2024

Update
I've run a basic test on cloudflare and this doesnt appear to be interfering with cloudflare pages "functions".
I'd feel a lot more comfortable knowing the directory is phyiscally ignored. For now the work around would be to make sure you don't include any markdown files in the folders?

The files inside the functions directory can't be served statically, since cloudflare will try to route requests matching file paths to matching code "handlers" and expect your code to handle them as REST requests. Which will just translate to GET requests that do or do not match any script files. There wont be any handlers matching the request, and I think what happens in that case, is the requests get converted into root requests for / and the paths get ignored.

For example, what I just tested;

I have a cloudflare function code at functions/api/contact-us.js that's hard coded to handl POST's and return json

{ 
  "cnt":1, 
   "message": "hello world" 
   }

When you try to make a GET request to myblog.com/api/contact-us, cloudflare returns the request as if you had made a GET request to "myblog.com".
And when you make a POST request, the cloudflare function handles the POST correctly.

For now there is a workaround, (which is to do nothing) and yes it's messy, but it's a low priority to fix? I might submit a PR to fix it shortly to avoid accidentally causing something to break. leaving it like this feels like big unexpected problem waiting to cause some unexpected pain later when we add some new functionality to fswalk or similar.

The fact that it doesnt cause a problem right now is just a happy co-incidence, and not by design.

There is a real risk that server side artifacts could accidentally be rendered out in some future enhancement and included in .dist/prod. E.g. developer's private readme.md notes etc. That could be quite bad for some devs.

from nue.

goblinfactory avatar goblinfactory commented on May 25, 2024

I thought of that, but then wondered if site.yaml should kept clean and only contain content matters, so that if you change your tech, the site.yaml shouldnt change. I think that might be a consideration for later, but for now the advantage of using site.yaml is not having to implement another settings strategy. I think that will come soon, (e.g. passing in environment variables from build server) but we can cross that bridge later.

very long way to say, I agree. I'll create a PR that looks for extra settings in site.yaml. Will need to update docs later when docs can be previewed by contributors ... as well.

from nue.

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.