Posts

Showing posts from May, 2017

Introduction to using ExpressJS with MongooseJS and NodeJS - Part 2

Image
This is a continuation of my previous blog on using express on NodeJS and MongooseJS. Please refer to that tutorial before continuing further in this tutorial. Here we gonna continue our previous applications CRUD functionalities, but first we gonna streamline our project by using nodemon package. Intializing Nodemon using following command, npm install nodemon --save-dev Here, Nodemon restarts the server automatically each time you save a file that the server uses. The reason for using it as only as a developing dependency is we only need it in development time. There are many ways to run the application using nodemon, but i will use a much simpler way, Here we gonna define nodemon in run script in package.json Now we need to enter the following command in terminal inorder to run the application, npm run dev So we are back to our main topic CRUD functionalities. We have already created GET-READ capability in previous tutorial. Let's start on POST-CREATE capabi...

Introduction to using ExpressJS with MongooseJS and NodeJS - Part 1

Image
First let's see what is this expressJS, According to their website, it's a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. Creation of APIs is easy and provides a thin layer of fundamental web application features, without obscuring Node.js features that you know and love.  So without further delay let's start coding, Start by creating a folder for this project. Navigate to it and run this command to create package.json which helps you to manage your dependencies, npm init  Then install express on your project, npm install express -save  Now let's create a simple server using Express.First create server.js file inside the app directory.Inside the file type the following code,   Here, we are using express in server.js by requiring it.Then we have created the server using listen method. Now run the server using following command, node server.js  Na...