forge.tutorial.viewmodels.go


Description
This sample is part of the Learn Forge tutorials.
Setup
For using this sample, you need an Autodesk developer credentials. Visit the Forge Developer Portal, sign up for an account, then create an app that uses Data Management and Model Derivative APIs. 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.
Run Locally
Before running the sample, you should set the client ID & secret
environment variables:
Mac OSX/Linux (Terminal)
export FORGE_CLIENT_ID=<<YOUR CLIENT ID FROM DEVELOPER PORTAL>>
export FORGE_CLIENT_SECRET=<<YOUR CLIENT SECRET>>
Windows (Command Prompt)
set FORGE_CLIENT_ID=<<YOUR CLIENT ID FROM DEVELOPER PORTAL>>
set FORGE_CLIENT_SECRET=<<YOUR CLIENT SECRET>>
Usage
There are 2 ways to run this sample:
-
Download the go_sample.zip archive appropriate to your OS from
releases.
Unzip it and start the sample executable from unzipped folder.
-
Install Go Programming Language.
Make sure you $GOPATH environment variable is set, this is required for first time usage.
You can use a /go/ folder under your user folder in case OSX and Linux OS:
// MacOS & Linux
export GOPATH=$HOME/go
In case of Windows, we recommend setting up the GOPATH into a simple location like C:\GOPROJECTS:
// Windows
set GOPATH=C:\GOPROJECTS
After the Go language is set up, run:
```bash
go get github.com/apprentice3d/forge.learning.viewmodels.go
```
and navigate to `$GOPATH/src/github.com/apprentice3d/forge.learning.viewmodels.go` and run
```bash
go run main.go
```
Once your app is started, open the browser:
http://localhost:3000
On the webpage, the New Bucket blue button allow create new buckets (as of now, minimum input validation is implemented). For any bucket, right-click to upload a file (objects). For demonstration, objects are not automatically translated, but right-click on a object and select Translate.
License
This sample is licensed under the terms of the MIT License.
Please see the LICENSE file for full details.
Written by
Denis Grigor @apprentice3d,
Forge Partner Development