Skip to content

Instantly share code, notes, and snippets.

@AVGP
Created November 6, 2017 12:50
Show Gist options
  • Save AVGP/df59c415e7c2d4ab5409742786785bcf to your computer and use it in GitHub Desktop.
Save AVGP/df59c415e7c2d4ab5409742786785bcf to your computer and use it in GitHub Desktop.
Hosting Data3D in Aframe
<!doctype html>
<html>
<head>
<script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
<script src="https://dist.3d.io/3dio-js/1.x.x/3dio.min.js"></script>
</head>
<body>
<a-scene>
<a-entity position="0 0 -2" io3d-data3d="url:untitled.gz.data3d.buffer"></a-entity>
</a-scene>
</body>
</html>
// Instructions:
// Run the following commands in the same folder that this file is in, then open http://localhost:8080
//
// npm install express express-static-gzip
// node server.js
var express = require("express");
var expressStaticGzip = require("express-static-gzip");
var app = express();
app.get('/untitled.gz.data3d.buffer', (req, res) => {
res.set('content-encoding', 'gzip')
res.sendFile(__dirname + '/untitled.gz.data3d.buffer')
})
app.use("/", expressStaticGzip("./"));
app.listen(8080, () => { console.log('server running') })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment