This is the ASP.NET Core backend part of an experimental Autodesk Forge sample app that is split across multiple GitHub repositories, namely:
- Frontend (HTML, CSS, JavaScript): https://github.com/petrbroz/test-submodules-frontend
- Node.js backend: https://github.com/petrbroz/test-submodules-backend-nodejs
- .NET Core backend: https://github.com/petrbroz/test-submodules-backend-netcore
- Autodesk Forge app
- .NET Core (LTS version)
- Git
-
Clone this repository with submodules:
git clone --recurse-submodules https://github.com/petrbroz/test-submodules-backend-netcore cd test-submodules-backend-netcore
-
Install .NET Core dependencies:
dotnet restore
-
Provide your Forge app client ID and secret via environment variables:
Bash (macOS/Linux) Command Prompt (Windows) export FORGE_CLIENT_ID=your-client-id
export FORGE_CLIENT_SECRET=your-client-secret
set FORGE_CLIENT_ID=your-client-id
set FORGE_CLIENT_SECRET=your-client-secret
Replace
your-client-id
andyour-client-secret
with your Forge app credentials. -
Run the server:
dotnet run
If you're using Visual Studio Code, make a copy the .env_template file
in the root folder, name it .env, and add your Forge client ID and client secret to it.
Now, you can run and debug your application from the editor using Run > Start Debugging or by pressing f5
.
Heroku does support git submodules
when using the standard git push heroku <branch>
deployment, meaning that if you have
the Heroku CLI tool installed, you can simply do:
heroku login
heroku create your-heroku-app --buildpack https://github.com/jincod/dotnetcore-buildpack.git
heroku git:remote -a your-heroku-app
heroku config:set -a your-heroku-app FORGE_CLIENT_ID=your-client-id
heroku config:set -a your-heroku-app FORGE_CLIENT_SECRET=your-client-secret
git push heroku master
Replace
your-client-id
andyour-client-secret
with your Forge app credentials, andyour-heroku-app
with your own Heroku app name.
Note that linking your Heroku app directly to a GitHub repo will not work, as Heroku cannot resolve git submodules in that case. To work around that limitation, you can remove the git submodule and start versioning its files as part of this repo, as explained here.