I presented the Express.js application to Confetti Cuisine, and they love it. They tell me that they’re ready to start promoting their cooking courses and want people who visit the site to subscribe to the school’s newsletter. The subscribers to this newsletter are potential customers, so Confetti Cuisine wants me to save each subscriber’s name, email address, and ZIP code.
When I have a database in place, Confetti Cuisine is comfortable with moving to the next stages of building user accounts. To accomplish this task, I need to build an application with
- A MongoDB database
- The Mongoose package
- A data schema with three fields
- A form for subscribing on the site
- A route to handle POST requests and save the subscriber data model
Now that Confetti Cuisine is ready to save user data, I need to install MongoDB and Mongoose for this project. First, I install MongoDB with Homebrew on my Mac by running brew install mongodb. Then I start the MongoDB server locally by running mongod.
In a new terminal window, in my project directory, I install the mongoose package by entering npm i mongoose -S in a new terminal window within my project folder.