Giter Site home page Giter Site logo

harriethijssen / workflow-node.js-view.and.data.api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from developer-autodesk/workflow-node.js-view.and.data.api

0.0 2.0 0.0 612 KB

A demo with the usage of viewer client in Node.JS

License: MIT License

JavaScript 81.42% HTML 18.58%

workflow-node.js-view.and.data.api's Introduction

Note: This repo is also used by our tutorial material. If you are following instructions from our tutorial, please ignore the instructions below.

Autodesk View and Data API Node.js Basic Sample

build status

Description

This sample demonstrates how to view a model in a web application with the Autodesk View & Data API. This web application implements a basic Node.js server and JavaScript/HTML5 client. It does not demonstrate how to upload a model to the Autodesk server for translation. See instructions below on how to prepare a model to be consumed in this sample.

Dependencies

Install Node.js on your machine and clone this repo. Download the project dependencies using npm before launching the app by running the following command in the project root directory:

npm install

This will install the following node.js modules in the project:

  • express
  • request
  • serve-favicon

As said, this sample does not include the workflow of uploading models to the server. It depends on other workflow samples to upload models and retrieve the model URNs, as explained in the Setup/Usage Instructions.

Setup/Usage Instructions

  • Apply for your own credentials (API keys) from developer.autodesk.com
  • From the sample root folder, rename or copy the ./credentials_.js file into ./credentials.js
    • Windows
      copy credentials_.js credentials.js 
      
    • OSX/Linux
      cp credentials_.js credentials.js  
      
  • Replace the placeholders with your own keys in credentials.js, line #23 and #24
    client_id: process.env.CONSUMERKEY || '<replace with your consumer key>',
    
    client_secret: process.env.CONSUMERSECRET || '<replace with your consumer secret>',
    
  • Upload one of your models to your account and get its URN using another workflow sample, for example:
  • Copy the URN which was generated in the previous step in file /www/index.js at line #18
    var defaultUrn = '<replace with your encoded urn>';
    
  • Run the server from the Node.js console, by running the following command:
    node server.js
    
  • Connect to you local server using a WebGL-compatible browser: http://localhost:3000/

This sample can also work with the Autodesk staging server (vs. production) or using someone else's credentials as long you can get a valid token. By default, the project is setup with the production server, and use your own credentials. If you are interested in a different setup, see the Options below.

Options

You can work with production or staging Autodesk View and Data environments. By default, the project is set up with the production server.

  • Instructions to setup this sample to use the Autodesk View & Data staging server are here

You can also use someone else's credentials to view models using this sample.

  • Instructions to set up this sample using someone else's credentials are available here

License

That samples are licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Written by Philippe Leefsma, Autodesk Developer Network.

workflow-node.js-view.and.data.api's People

Contributors

autodesk-adn avatar cyrillef avatar duchangyu avatar shiya avatar stephenpreston avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.