The Fastest Way to a Quick Starter App with Express.js
Over the years I’ve used Express.js many times as a quick getting started example app. Since I often reference it I wanted to provide a short post that shows exactly what I do 99.9% of the time to start one of these quick Express.js reference apps. I’ve detailed in this post how to get started with Express.js the fastest way I know. There is one prerequisite, I’m assuming in this post you’ve already got Node.js installed. With that in mind, check out my installation suggestions for Node.js if you need to get that installed still. The other thing, is you’ll need to have git installed. On MacOS and Linux git is most likely installed already, if you’re on Windows I’ll leave that googling exercise up to you.
Create a directory and navigate into the directory.
mkdir quick-start-express
cd quick-start-express
Now in that directory execute the following command. Note, this command is available as of node.js 8.2.0.
npx express-generator
npm install
Inside that directory that you’ve navigated to, you’ll now have an Express.js skeleton app setup to run with the dependencies now downloaded with npm install
. On MacOS or Linux run the following command to start the web app.
DEBUG=quick-start-express:* npm start
If you’re on Windows run the following command.
set DEBUG=quick-start-express:* & npm start
That’s it, one of the quickest ways to get a Node.js site up and running to start developing against!
Cheers, and happy thrashing code!