nomadic_aviator Posted October 14, 2015 Share Posted October 14, 2015 Hello, I have another question about the real estate project I am working on. I am using Node.js as the server for this project. It is fairly straightforward and I have gotten the application to work except for one part. When i look at the console, it appears that the app wont get the .babylon file I am importing into my scene. I am not sure how to solve this but I have uploaded this project on Github if you would like to take a look: https://github.com/nomadicvince/WebGL-and-Node I have found an Babylon.js npm, but I don't see any tutorials on how to use it in the app. Is my approach to this wrong? Quote Link to comment Share on other sites More sharing options...
dotJayEss Posted October 14, 2015 Share Posted October 14, 2015 Your Express server is not aware of how to handle the .babylon extension. You will experience this issue in pretty much any server environment as most servers will not recognize this extension and thus will not know the mime type. In your app.js you will need to add to the mime table. I haven't used express in a while, but this used to be done like this: app.mime.type['.fx'] = 'application/fx';app.mime.type['.babylon'] = 'application/babylon';app.mime.type['.babylonmeshdata'] = 'application/babylonmeshdata'; While the syntax may not be right it should point you in the right direction, you are looking for a way for the server to respond with the proper mime type in the header when the .babylon extension is being requested. Jaskar 1 Quote Link to comment Share on other sites More sharing options...
nomadic_aviator Posted October 18, 2015 Author Share Posted October 18, 2015 Thank you very much. Quote Link to comment Share on other sites More sharing options...
KarelAnker Posted October 23, 2015 Share Posted October 23, 2015 How did you fix it? I've tried this: express.static.mime.define({'application/babylon': ['babylon'],'application/fx': ['fx'],'application/babylonmeshdata': ['babylonmeshdata']});but that didn't really work Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted January 9, 2017 Share Posted January 9, 2017 Hello Babylon community, -->Here is good example, of NodeJS serving .babylon files<-- It uses Dynamic Mime Types to populate the response.Content-type field, from the request file sent. But, at just the right moment in Node.createServer(...). Basically this: res.writeHead(200,{ "Content-type" : mimeType, //<-- SET dynamic MIME TYPE when .babylon files come through. "Content-Length" : contents.length }); Instructions: With node installed, clone git, then cmd line run> node server Result (localhost:8080): .babylon meshes loaded successfully by Node in two ways: AssetsManager && SceneLoader.ImportMesh. GameMonetize and NasimiAsl 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.