0
votes

I am using Netlify to host a github repo and am trying to find a way to host additional files on the domain.

( If you don't know what Netlify is check it out. It's a fast dirty and free version of AWS code deploy as far as I understand. (Disclaimer have not used AWS code deploy))

Example

Base Domain:

https://physiome-test.netlify.com/

Load a 3D model from

https://physiome-test.netlify.com/3Dmodels/heart/fullheart.json

Does anyone know if this is possible? I understand that they only provide 'static sites' but I don't see why that couldn't include file storage so that one doesn't have to worry about CORS

1
I answered your question and made suggestions to fix some of your issues. There may be other issues you will have to address with relative paths though, so this is not going to be a full fix, but should get you started.talves

1 Answers

2
votes

Netlify will host all static content in the folder you tell it to on deploy. You are currently telling Netlify to put your whole repository into the site starting at the root of the repository. This is causing issues with your relative paths.

You can go to any path in your repository at this time on your site and get a returned response of the file.

Solution:

Build your site into one build location and have Netlify deploy that location to the site. Any path relative to the root path of the location will be the root of your site.

1. Put the body assets under your simple_heart/models directory at simple_heart/models/body

2. netlify.toml (root of your repository)

[build]
  command = "cp -r ./simple_heart ./build && npm run build"
  publish = "build"

3. Fix your index.html in the simple_heart to reflect the relative paths from the root of simple_heart which will now be the root of your site with the build assets physiomeportal.js and physiomeportal.min.js at the root of your site.

note: To see this, run the command from the root of your site on a local build.