hello . i’m thinking of import babylon files and textures from the server side to memory when the user needs them for better UX but i’m little confused cause the syntax of importing 3d models is by taking file paths or urls . but i don’t know how to make a rout with express that the “SceneLoader.ImportMeshAsync()” read from it directly and render the 3d asset.
i tried to use some express APIs like res.send or res.sendFile then make blob url so babylon client side can read from it but it always logging errors in the console.
is there any way i can use express to serve those assets when the user needs ? please help
1 Like
You should just be able to configure static to serve all of your assets if they are actual files (unless you are dynamically generating the assets or need security).
app.use(express.static('public'))
Serving static files in Express (expressjs.com)
3 Likes
thanks for the reply
doesn’t that load the assets all at once ? cause when i look at the network tab in the devtool in the browser i don’t see files loaded as requests from some endpoints like the examples i saw .
isn’t better for user exp to make the server has those assets and send to the client side what he needs ? at the right time ? cause now im trying stuff with static serve of express but i don’t know if it the best way for something serious
static won’t load all the assets at once. it just means that when needed the client will request the assets from the server over HTTP - this is the same as a browser loading your game/site.
1 Like
ah ok , i saw people using things like fitching making blobs and url objects , i thought i"m doing something wrong .
thank you for your time . i appreciate it