To do that we click the green run button on the top toolbar in WebStorm, if we wanted to debug the app (to be able to set breakpoints, step through our server JavaScript code, and set watch variables), we could hit the debug button just next to the run button instead. Now that we’ve seen a bit of what was created in our new Node.js Express project, let’s start up the Node.js server and see what it looks like in the browser. You can learn more Jade template syntax here. Link(rel='stylesheet', href='/stylesheets/style.css') The index.js and user.js files we have within routes contain functions that correspond with the configured url routes within the app.js file: You can also see we have a node_modules directory setup by npm for the packages our project required, and a public directory for our client side javascript, css, images, etc… You’ll also notice that we have a directory called routes, and one called views. In the main directory WebStorm has created app.js, our main entry point for our Node.js application, app.js has been initialized to use some modules, configure the template engine to jade, setup routes and start listening on the configured port (which in our case happens to be 3000). Let’s take a look at the directory structure created by WebStorm: On the next screen you need to ensure WebStorm knows where the node executable files are and make sure you have “Jade” selected as the template engine:Īfter clicking ok, WebStorm will use npm (the node package manager) to download express and jade to your project directory under the “node_modules” folder. Once you have WebStorm installed, fire up the IDE and we can create our first Node.js Express application using the Jade template engine.Ĭlick “Create New Project” from the welcome screen.Įnter a project name, project location and choose “Node.js Express App” as the project type. Also ensure you’ve already installed node.js over at. If you are ready to see how WebStorm and Express make Node.js development fast and enjoyable, go to and download and install the trial version. Before diving into the WebStorm IDE and Express, I suggest you go through the Node Beginner Book tutorial so that you have a better understanding of the core Node.js platform. In this post I’ll be explain how to quickly get up and running with Node.js and Express, a great web application framework for Node.js that handles a good bit of the plumbing described in the Node Beginner Book such as building a request router. Manuel Kiessling’s Node Beginner Book goes through a great Node.js tutorial and explains in detail how to call long running processes (such as a database query or disk I/O operation) and not cause the request to block other operations. To achieve high concurrency and scalability, Node.js leverages JavaScript’s event loop and function callbacks for longer running processes so that complex concurrent thread locking logic is not required. Node.js is a popular framework for building scalable server-side applications in JavaScript. Over the last few weeks I’ve been experimenting with Node.js and learning about how to use some of the great packages written for it. Getting started with Node.js, Express and Jade using the WebStorm IDE
0 Comments
Leave a Reply. |