Comments (8)
I think html generated in callback via render in too late and function returns default empty output:
if (template) {
locals = locals || {};
locals.messages = flash;
res.render(template, locals, function (err, html) {
if (html) {
output = html;
}
});
} else {
//...
}
return output; // I THINK THIS LINE WINS TO CALLBACK IN RENDER
from express-messages.
Not quite sure what is going on here, paging @agraboso!
from express-messages.
Any movement on this?
from express-messages.
Paging @agraboso again!
from express-messages.
I believe @akobashikawa's assessment is correct. The obvious fix would be to render the template synchronously, but express
disallows that by not exposing the rendering engine(s). We might have to simply import a templating library...
from express-messages.
Thanks @agraboso. Would that not end up to blocking the request though? Is there any way to handle this async? Maybe we could take in next
and call that from within the function or change the signature to return our own callback?
from express-messages.
@artcommacode: I don't see how to do this async at all. After a good deal of thought, I think the best way to deal with this is to delegate rendering to the user in exactly the way flash does — so maybe we should deprecate this module and point users to flash.
from express-messages.
so we can't use custom template for this package ....
from express-messages.
Related Issues (18)
- Doesn't work with Jade Templates HOT 1
- The readme should say how to add messages HOT 5
- Express 3 HOT 9
- move to expressjs org?
- Customizable message template HOT 3
- Use this with Handlebars? HOT 10
- Custom template collision with express-ejs-layouts module HOT 2
- custom template with EJS HOT 1
- Is this repo still under maintainance ? HOT 5
- Custom templates using handlebars HOT 1
- Problem with != messages()
- how can i use express-messages with handlebars HOT 2
- Can i use it without defining res.locals.messages?
- Doesn't render HTML
- Problem with error message loop pug to ejs
- Not working with ejs
- req.flash() message doesn't work along with res.redirect() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-messages.