PRO 30% Free • Stripe ($15) & Razorpay (₹899)

Run a Full-Stack Web Application

Top Course Staff · 3 min read · Web development · PRO · 30% Free Preview Available

Run a Full-Stack Web Application

In this article, you will learn how to use npm and MongoDB on your computer to run the Cake Bar application that you interacted with in theWhy Test?course. You will also run the Cake Bar test suite from your terminal and see all the tests passing.

When you’re done, spend some time looking through the application. Pay special attention to the structural similarities between the implementation code and the test code in thetestdirectory.

If you get stuck during the below steps and can’t resolve the issue by yourself, your fellow learners might be able to help! Post the following information in a Slack message to your group: (i) the full error message, (ii) your node and npm versions, and (iii) steps to reproduce the issue. Runnode -vandnpm -vto find your versions.

Setup the Why Test? Example application:

  • Download the source code for theCake Bar web application.
  • Unzip the folder you just downloaded.
  • Skip this step if you already have a MongoDB process running. If not, open a new command line session, and use the following command to start a new MongoDB instance.
$ mongod --dbpath ~/data/db
  • Keep your current terminal session open and open a new terminal window. In your new terminal session, navigate to the Cake Bar directory that you unzipped. You can navigate to the Cake Bar directory by typingcdinto your command line, then dragging and dropping the Cake Bar folder from your finder.
  • Runnpm installto download all of the required node packages for the Cake Bar application.
  • From your command line, runnpm testto execute the Cake Bar test suite. After a few seconds you should see all of the tests pass in your terminal. (If you don’t see all tests passing, go toserver.config.jsand change8001to8000.)
  • Runnpm startto start your server. When you see “listening on port 4001”, move to the next step.
  • In your browser, visithttp://localhost:4001to see the Cake Bar application.
  • Celebrate!
  • Download the source code for theCake Bar web application.
  • Unzip the folder you just downloaded.
  • If you don’t have MongoDB running in the background already, open the powershell, and use the following command to start a new mongo instance. The following command works for MongoDB version 3.4. If you’ve downloaded a different version, replace “3.4” with the version number.
& 'C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe'

4. Open Git Bash. In your new session, navigate to the Cake Bar directory that you unzipped. You can navigate to the Cake Bar directory by typingcdinto your terminal, then dragging and dropping the Cake Bar folder from your finder. 5. Runnpm installto download all of the node packages the application requires. 6. Runnpm testto run the Cake Bar test suite. After a few seconds, you should see all of the tests pass in your terminal. (If you don’t see all tests passing, go toserver.config.jsand change8001to8000.) 7. Runnpm startto load the application’s dependencies and start your server. 8. Visithttp://localhost:4001to see the application in your browser. 9. Celebrate!

'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'

30% Free Preview Reached · Unlock Remaining 70%

Complete Payment to Unlock Full Guide & Source Code

You are viewing the 30% preview. Join TopCourseAI Pro to unlock the remaining 70% of this article, unblur all code snippets, and gain full access to all 412 technical projects and guides.

✓ Full Access to All 160+ Projects
✓ Instant Blur Removal Everywhere
✓ Production Source Code & Blueprints
✓ All Future Deep Dives Included
Instant Unhindered Activation ·
End of Preview · Unlock Complete Blueprint & Source Code

Ready to access the complete step-by-step tutorial?

Gain full unhindered access to all 412 technical projects and guides, unblur all source code snippets, and download runnable scripts.

Production AI Blueprints

Ready to build production-grade AI systems?

Enjoyed this guide? Continue exploring our library of 166+ production blueprints, multi-agent swarms, and autonomous agent systems with 100% unblurred, executable source code.