Using Onsen, How To Write Server Side Code In Nodejs That Will Render Jade Files As Html In A Splitter
Solution 1:
Hmm. Since your code seems relatively small I would guess that what it does may be just serving all your files from views and actually "rendering" them. So probably you are just failing to access them properly later on. Maybe you have a url like /search.html
or /search
(instead of /search.jade
). Could you try to confirm whether you can access such a url?
Also is your index.jade
file served in some other way like startingPoint: 'index.jade'
or something similar or is it also located in the views
folder?
Basically as long as your index file has the same treatment as your other views then everything should be fine.
Update: With what you just provided we can see the way in which you are serving your index.
app.get('/', function(req, res, next) {
res.render('index', { title: 'Fitness App' });
});
The equivalent of that is exactly the same as what you said you had before:
app.get('/user/search', function(req, res, next) {
return res.render('searchForTrainer');
});
Here res.render
is what converts your jade into html and then returns it to the client. Since the splitter is expecting html that means you shouldn't have made changes to the server when you started using it.
Here is how the process looks like:
Client | HTTP | Server
| |
content.load('page') → GET /page ↘
| | res.render('page') // convert jade to htmlhtmlisloaded ← 200OKhtmlcontent ↙
insplitter.content | |
TL;DR - if you use your old route everything should be fine. Just remember to change the page url in the splitter from search.jade
to /user/search
(or whatever the url for will be).
Post a Comment for "Using Onsen, How To Write Server Side Code In Nodejs That Will Render Jade Files As Html In A Splitter"