The backend requires Node in minimum version 7.6. Get it here
The dependencies (express and body-parser) are installed by executing the following command:
npm install
npm start
Open the following URL in the browser:
localhost:3000
Open the file Dynamo-BIM-BOT.dyn
in Revit/Dynamo while the server is running to confirm that the connection is working.
For testing purposes, nodemon is a good tool as it takes care of restarting the server every time you make a change to the file. To install it, do the following:
- Close server (ctrl+c)
- Install nodemon by executing command
npm install -g nodemon
- Now start the server using this command instead:
nodemon app.js
First step is to get a good understanding of how node/express works. Read through the program and try the following:
- Change route
/data
to returnhere is some other data
instead, and confirm that it works both in the browser and with Dynamo - Make a new post route
/hello
that reads the body element and simply returnshello $var
(just do it in pure Javascript) - change route
/data
to use another program in your preferred language
Play around and have fun! You could try some more advanced stuff:
- Get data from another public API using the request package (
npm install request
) - even easier with request-promise as it returns promises and thereby supports async/awain - Copy the project and run another API locally (on another port than 3000) and make API1 request data from API2
- Connect with a database mongo for instance
- Dig into the wonderful world of Linked Building Data