https://github.com/yiskang/forge-viewhubmodels-nodejs-svf2
Learn Forge Tutorial: View your BIM 360 & Fusion models using 3-legged OAuth. Available in Nodejs with OTG/SVF2 support
https://github.com/yiskang/forge-viewhubmodels-nodejs-svf2
autodesk-bim360 autodesk-data-management autodesk-forge nodejs
Last synced: 27 days ago
JSON representation
Learn Forge Tutorial: View your BIM 360 & Fusion models using 3-legged OAuth. Available in Nodejs with OTG/SVF2 support
- Host: GitHub
- URL: https://github.com/yiskang/forge-viewhubmodels-nodejs-svf2
- Owner: yiskang
- License: mit
- Created: 2021-01-06T12:29:20.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-14T09:30:30.000Z (about 3 years ago)
- Last Synced: 2025-02-06T17:41:17.829Z (3 months ago)
- Topics: autodesk-bim360, autodesk-data-management, autodesk-forge, nodejs
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# forge.tutorial.viewhubmodels - Nodejs
[](https://nodejs.org/)
[](https://www.npmjs.com/)

[](http://opensource.org/licenses/MIT)[](http://developer.autodesk.com/)
[](http://developer.autodesk.com/)
[](http://developer.autodesk.com/)
[](http://developer.autodesk.com/)
# Description
This sample is part of the [Learn Forge](http://learnforge.autodesk.io) tutorials.
# Setup
## Prerequisites
1. **Forge Account**: Learn how to create a Forge Account, activate subscription and create an app at [this tutorial](http://learnforge.autodesk.io/#/account/).
2. **Visual Code**: Visual Code (Windows or MacOS).
3. **JavaScript ES6** syntax for server-side
4. **JavaScript** basic knowledge with **jQuery**For using this sample, you need an Autodesk developer credentials. Visit the [Forge Developer Portal](https://developer.autodesk.com), sign up for an account, then [create an app](https://developer.autodesk.com/myapps/create). For this new app, use **http://localhost:3000/api/forge/callback/oauth** as Callback URL, although is not used on 2-legged flow. Finally take note of the **Client ID** and **Client Secret**.
## Running locally
Install [NodeJS](https://nodejs.org), version 8 or newer.
Clone this project or download it (this `nodejs` branch only). It's recommended to install [GitHub desktop](https://desktop.github.com/). To clone it via command line, use the following (**Terminal** on MacOSX/Linux, **Git Shell** on Windows):
git clone -b nodejs https://github.com/Autodesk-Forge/learn.forge.viewhubmodels.git
To run it, install the required packages, set the enviroment variables with your client ID & secret and finally start it. Via command line, navigate to the folder where this repository was cloned and use the following:
Mac OSX/Linux (Terminal)
npm install
export FORGE_CLIENT_ID=<>
export FORGE_CLIENT_SECRET=<>
export FORGE_CALLBACK_URL=<>
npm startWindows (use **Node.js command line** from Start menu)
npm install
set FORGE_CLIENT_ID=<>
set FORGE_CLIENT_SECRET=<>
set FORGE_CALLBACK_URL=<>
npm startOpen the browser: [http://localhost:3000](http://localhost:3000).
## Packages used
The [Autodesk Forge](https://www.npmjs.com/package/forge-apis) packages is included by default. Some other non-Autodesk packaged are used, including [express](https://www.npmjs.com/package/express) and [multer](https://www.npmjs.com/package/multer) for upload.
# Further Reading
Documentation:
- [BIM 360 API](https://developer.autodesk.com/en/docs/bim360/v1/overview/) and [App Provisioning](https://forge.autodesk.com/blog/bim-360-docs-provisioning-forge-apps)
- [Data Management API](https://developer.autodesk.com/en/docs/data/v2/overview/)
- [Viewer](https://developer.autodesk.com/en/docs/viewer/v6)### Tips & Tricks
For local development/testing, consider use [nodemon](https://www.npmjs.com/package/nodemon) package, which auto restart your node application after any modification on your code. To install it, use:
sudo npm install -g nodemon
Then, instead of **npm run dev**, use the following:
npm run nodemon
Which executes **nodemon server.js --ignore www/**, where the **--ignore** parameter indicates that the app should not restart if files under **www** folder are modified.
### Troubleshooting
After installing Github desktop for Windows, on the Git Shell, if you see a ***error setting certificate verify locations*** error, use the following:
git config --global http.sslverify "false"
## License
This sample is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details.
## Written by
Petr Broz [@petrbroz](https://twitter.com/petrbroz), [Forge Partner Development](http://forge.autodesk.com)
Eason Kang [@yiskang](https://twitter.com/yiskang), [Forge Partner Development](http://forge.autodesk.com)