Starter code for the Melody App tutorial using p5.js, Node.js and Express.js. This code is developed in detail in the Getting Started with Node.js tutorial
node -v
and npm -v
Follow step 2 in Get Started with Node.js
Install Express.js in your project directory by creating a package.json
file.
- Open a command prompt window on your computer (Terminal on Mac or Command Shell on Windows)
- In the command prompt window, navigate to the directory with this file. If you saved this file in your
downloads
folder you can typecd/downloads/melodyAppSetup-main
and press return - Create a
package.json
file by typeingnpm init -y
and pressing return - Install Express.js by typing
npm install express
and pressing return - Verify installation by typing
npm list
and pressing enter Your terminal should display a tree structure listing allnpm
packages installed on your computer. If Express.js is installed in your directory, you should see something similar to this:
[email protected] /Users/..filepath
└── [email protected]
Visit this tutorial for more information on Express.js, and Get Started with Node.js for helpful steps and tips if you get stuck.
node server.js
in the terminal
5. Visit http://localhost:3000 using your browser and inspect the console.
You should see a JSON object like this printed to the console:
Object i
files: Array(3)
0: “C Major Scale.json”
1: “Frere Jacques.json”
2: “Mary's Lamb.json”
length: 3
//…prototype
This starter code already prints the filenames from the songs file in your browsers console!
You are ready to continue with the Melody App tutorial!
You can also read more aboute the p5.Oscillator library here