MongoDB, Express, AngularJS (1.6) and Node.js (MEAN)

  • Node.js applications are written in JavaScript and the presence of abundant modules using npm (Node Package Manager) makes it super easy to develop applications using Node.js.
  • We’re going to develop our application using AngularJS as the front-end framework to fine-tune our DOM, Node.js as the back-end engine, Express.js as the server-side communication platform, and MongoDB as the data store.
  • Now, we’ll create a project directory and navigate to it in our terminal using the following unix command:

    Then, we’ll initialize the Node project using npm by running:

    This will prompt you with questions about the project, like the name and version, to generate the package.json file.

  • Now our project folder structure should look like this:

    while our package.json file should look like this:

    We’re now ready to create our scripts to serve our application from the back-end server using Express.

  • In the next tutorial, we will set up the Express server, create static files, and run a sample application in the browser.

Learn web application development using mongoDB, ExpressJS, AngularJS and NodeJS (MEAN).

@JavaScriptKicks: MongoDB, Express, AngularJS (1.6) and Node.js (MEAN) by _ethanet #javascript via JavaScriptKicks

Welcome to the first tutorial of this series, which will explain the basics of setting up a MEAN project. If you’re already comfortable setting up a MEAN project, feel free to move on to the next tutorial. However, if you’re a beginner to the MEAN stack, I’m hoping that you’ll pick up a thing or two from this 

MEAN stands for MongoDB, ExpressJS, AngularJS, and Node.js. Let’s quickly walk through each of them:

MongoDB is a non-relational, NoSQL database written in C++. In other words, it’s a database that stores data as objects, where each object has a unique _id, as opposed to storing data in tables, used by relational databases. Generally, non-relational databases are easy to use and require little technical expertise.

Express.js is a Node.js web application framework. It lets us add some back-end functionalities to our plain JavaScript application.

and many other useful features that can make our HTML views dynamic.

Node.js is a cross-platform runtime environment for developing server-side and networking applications. Node.js applications are written in JavaScript and the presence of abundant modules using npm (Node Package Manager) makes it super easy to develop applications using Node.js.

We’re going to develop our application using AngularJS as the front-end framework to fine-tune our DOM, Node.js as the back-end engine, Express.js as the server-side communication platform, and MongoDB as the data store. Easy, huh!

To begin developing our application, we need to have the following installed:

Run the following command on the terminal to verify your installation:

(displays node version: i.e. v6.10.0)

(displays npm version: i.e. v5.0)

(starts mongodb server locally)

Once we have these setup, we can install the other dependencies using npm on the command line.

Now, we’ll create a project directory and navigate to it in our terminal using the following unix command:

Then, we’ll initialize the Node project using npm by running:

This will prompt you with questions about the project, like the name and version, to generate the package.json file. We’ll use the defaults for now and make changes to the generated file later.

After that, we’ll install Node dependencies for our project. To do this, we’ll run:

This command will install our dependencies. Notice that we used the –save flag to ensure that the package.json file is updated with the changes. We also installed Mongoose to enable us to use a structured model-schema framework for our application.

Now our project folder structure should look like this:

while our package.json file should look like this:

We’re now ready to create our scripts to serve our application from the back-end server using Express.

I know this is a lot of theoretical stuff, but I promise we’ll write a bunch of code next time.

In the next tutorial, we will set up the Express server, create static files, and run a sample application in the browser.

Feel free to drop your comments below — I’ll be happy to get back to you!

This post is originally published by the author here. This version has been edited for clarity and may appear different from the original post.

MongoDB, Express, AngularJS (1.6) and Node.js (MEAN)

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.