GithubHelp home page GithubHelp logo

Redirect crash app about aqua HOT 5 CLOSED

gr7d avatar gr7d commented on May 28, 2024 1
Redirect crash app

from aqua.

Comments (5)

gr7d avatar gr7d commented on May 28, 2024

It's not yet possible to replace the content of a static file if that's what you are trying to achieve. I'm working on adding this feature in the next coming days thanks to this issue.

Regarding your problem:
Not all responses have a content key. For example, a RedirectResponse has none, so you would need to check if there's a content key.

res.content = res.content?.replace('- aquaTest -', testData)

The wrong example shown in the README is going to be changed once I added the possibility to replace the content of static files.

Thanks for opening this issue :)

from aqua.

gr7d avatar gr7d commented on May 28, 2024

Middlewares are now (v1.0.19) able to manipulate raw file data.
Please take a look at the new middleware example.

from aqua.

 avatar commented on May 28, 2024

Thanks!
But there is still a question!

in the new example, everything works well!
Code:

1

And result ...

2

but if you still declare the template in app.register but it is not in the document - nothing happens!

  1. Add more

3

  1. in HTML

4

  1. and result

5

replace first test string is not working.

I really love aqua for being able to use such simple templating without connecting dejs, denjucks and more modules, maybe can I fix it somehow? -)

from aqua.

gr7d avatar gr7d commented on May 28, 2024

It's because you aren't piping the return value to the other replacement line.
What you're trying to achieve should be something like this:

    res.content = textContent
        ?.replace("- aquaTest1 -", testData1)
        ?.replace("- aquaTest2 -", testData2)

from aqua.

 avatar commented on May 28, 2024

Of course, sorry this is my mistake.
Thank you very much! You've helped me a lot!

from aqua.

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.