CanJS component is not rendering server-side with done-ssr middleware

main file has the following code:
define(['can', 'tests/test.mustache!', 'tests/testcomponent.mustache'], function(can, template, componenttemplate) { can.Component.extend({ tag: 'some-component', template: componenttemplate, viewModel: { some: 'componentdata' } }) var Test = can.Control.extend({ init: function(el) { can.$(el).html(template({ testData: 'controllerdata' })) } }) return function(request) { var test = new Test(document.body); } })
some-component stays unrendered as <some-component></some-component>
what should i do to render this?

What is ‘body.document’? Thats not working like this way.
please look into donejs-serve
how to set up express with done-ssr-middleware

document.body is a vdom node, i think. According to my main should export a render function.

I set up middleware this way

var ssr = require('done-ssr-middleware');
var app = express();

app.use('/', ssr({
  config: __dirname + '/package.json!npm',

This method and can-serve are about solving the same problem,aren’t they? both of them can server-side render?

can.view.callbacks._tags says that callback is already prepared, but not triggered. :disappointed:

I want to set up server-side rendering for an already written project with canjs + stealjs. Thus, I decided to use done-serve. While i use only can.Control, everything works, but can.Component does not work and I do not know why. The example I put on git How can i properly use the done-serve, to render can.Component on server?

It helped to rename .mustache -> .stache

1 Like

Did that fix it for you? I’m guessing mustache does not render server-side.