|
1 | | -# scenes-tutorial |
2 | | -Code for following the Scenes API Tutorial |
| 1 | +# Getting Started with the iTwin Viewer Create React App Template |
| 2 | + |
| 3 | +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). |
| 4 | + |
| 5 | +## Environment Variables |
| 6 | + |
| 7 | +Prior to running the app, you will need to add OIDC client configuration to the variables in the .env file: |
| 8 | + |
| 9 | +``` |
| 10 | +# ---- Authorization Client Settings ---- |
| 11 | +IMJS_AUTH_CLIENT_CLIENT_ID="" |
| 12 | +IMJS_AUTH_CLIENT_REDIRECT_URI="" |
| 13 | +IMJS_AUTH_CLIENT_LOGOUT_URI="" |
| 14 | +IMJS_AUTH_CLIENT_SCOPES="" |
| 15 | +``` |
| 16 | + |
| 17 | +- You can generate a [test client](https://developer.bentley.com/tutorials/web-application-quick-start/#3-register-an-application) to get started. |
| 18 | + |
| 19 | +- Viewer expects the `itwin-platform` scope to be set. |
| 20 | + |
| 21 | +- The application will use the path of the redirect URI to handle the redirection, it must simply match what is defined in your client. |
| 22 | + |
| 23 | +- When you are ready to build a production application, [register here](https://developer.bentley.com/register/). |
| 24 | + |
| 25 | +You should also add a valid iTwinId and iModelId for your user in the this file: |
| 26 | + |
| 27 | +``` |
| 28 | +# ---- Test ids ---- |
| 29 | +IMJS_ITWIN_ID = "" |
| 30 | +IMJS_IMODEL_ID = "" |
| 31 | +``` |
| 32 | + |
| 33 | +- For the IMJS_ITWIN_ID variable, you can use the id of one of your existing iTwins. You can obtain their ids via the [iTwin REST APIs](https://developer.bentley.com/apis/itwins/operations/get-itwin/). |
| 34 | + |
| 35 | +- For the IMJS_IMODEL_ID variable, use the id of an iModel that belongs to the iTwin that you specified in the IMJS_ITWIN_ID variable. You can obtain iModel ids via the [iModel REST APIs](https://developer.bentley.com/apis/imodels-v2/operations/get-imodel-details/). |
| 36 | + |
| 37 | +- Alternatively, you can [generate a test iModel](https://developer.bentley.com/tutorials/web-application-quick-start/#4-create-an-imodel) to get started without an existing iModel. |
| 38 | + |
| 39 | +- If at any time you wish to change the iModel that you are viewing, you can change the values of the iTwinId or iModelId query parameters in the url (i.e. localhost:3000?iTwinId=myNewITwinId&iModelId=myNewIModelId) |
| 40 | + |
| 41 | +## Available Scripts |
| 42 | + |
| 43 | +In the project directory, you can run: |
| 44 | + |
| 45 | +### `npm install` |
| 46 | + |
| 47 | +Install dependencies |
| 48 | + |
| 49 | +### `npm start` |
| 50 | + |
| 51 | +Runs the app in the development mode.\ |
| 52 | +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. |
| 53 | + |
| 54 | +The page will reload if you make edits.\ |
| 55 | +You will also see any lint errors in the console. |
| 56 | + |
| 57 | +### `npm test` |
| 58 | + |
| 59 | +Launches the test runner in the interactive watch mode.\ |
| 60 | +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. |
| 61 | + |
| 62 | +### `npm run build` |
| 63 | + |
| 64 | +Builds the app for production to the `build` folder.\ |
| 65 | +It correctly bundles React in production mode and optimizes the build for the best performance. |
| 66 | + |
| 67 | +The build is minified and the filenames include the hashes.\ |
| 68 | +Your app is ready to be deployed! |
| 69 | + |
| 70 | +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. |
| 71 | + |
| 72 | +### `npm run eject` |
| 73 | + |
| 74 | +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** |
| 75 | + |
| 76 | +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. |
| 77 | + |
| 78 | +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. |
| 79 | + |
| 80 | +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. |
| 81 | + |
| 82 | +## Notes |
| 83 | + |
| 84 | +If you are not using NPM, remove the `USING_NPM` env var from [.env](./.env) |
| 85 | + |
| 86 | +## Next Steps |
| 87 | + |
| 88 | +- [iTwin Viewer options](https://www.npmjs.com/package/@itwin/web-viewer-react) |
| 89 | + |
| 90 | +- [Extending the iTwin Viewer](https://developer.bentley.com/tutorials/itwin-viewer-hello-world/) |
| 91 | + |
| 92 | +- [Using the iTwin Platform](https://developer.bentley.com/) |
| 93 | + |
| 94 | +- [iTwin Developer Program](https://www.youtube.com/playlist?list=PL6YCKeNfXXd_dXq4u9vtSFfsP3OTVcL8N) |
0 commit comments