Serving local mesh files to babylon

Hi there,
I’m trying to get this webapp running where users can load/drag-drop meshes (stl and obj) from their hard drive onto the babylon canvas and get a 3D-preview with some added functionality.

After trying:
BABYLON.SceneLoader.ImportMesh(“”, “localMesh.obj”, “”, scene, function(newMeshes) {});
and getting:
“Access to XMLHttpRequest at ‘file:///…’ from origin ‘null’ has been blocked by CORS policy”

And reading through this thread:

Apparently for security reasons the browser can not directly acess files on the local drive.
I don’t know if this is correct since I don’t have much frontend experience.

It left me wondering how websites like shapeways.com and others handle those file imports.
Do they send the meshes to a server first for processing and then serve the response from the server back to the user?
How do they do that if the website can’t access local data?

Thanks for helping out if these questions are too basic. Really appreciate it
-S

Hi @HEAD and welcome to the forum. You need to run your webapp through a local server. You can install Node.js (which installs npm) and then the ws package ws - npm.

Other local servers are available.