I am trying to put my .gltf
model into a database. I built a restful API to get it from the database. But when I put the URL into Cesium's framework, an error occurs. The error is shown below.
Sandcastle.addToolbarButton('models', function () {
// eslint-disable-next-line
var model = viewer.scene.primitives.add(Cesium.Model.fromGltf({
id: 'house',
url: 'http://127.0.0.1:8000/test',
// url: gltf_data,
modelMatrix: modelMatrix,
scale: 0.1
}))
}, 'singleModel')
front end javascript code
class Test(flask_restful.Resource):
def get(self):
client = MongoClient()
db = client['test']
fs = gridfs.GridFS(db)
for x in fs.find():
data = x.read()
break
data = data.decode('utf-8')
# file = fs.find_one()
return jsonify(data)
server end python code
JSON.parse()
to turn the string into an object. – emackey