/node_todo

A simple checklist application using nodeJS

Primary LanguageJavaScript

node_todo

A simple checklist application using nodeJS to create the package.json

Requirements

Setup the envirement

  1. initialisation od the project to create the package.json:
 npm init 
  1. install our dependencies (--save will save the package to dependencies in package.json, replace it by --save-dev to save them in devDependencies in package.json):
  • install EJS (Embedded JavaScript templating): used to be able to write Javascript code with the HTML files
npm install ejs --save 
  • install body-parser that will be used to parse the http request
npm install body-parser --save
  • install mongoose to connect to our databse
npm install mongoose --save  
  1. Use mlab to create your noSql database and get your connection string to be able to connect to it using mongoose.

  2. Insttall and setup Docker

Run the app

Before running the app you need to create a user in the MongoDB (mlab) database and put the credentials in config.json also change the connection string in index.js file.

  • Development:
nodemon app.js  
  • Otherwise
node app.js

Building your docker image

  • Run the docker engine:
 sudo systemctl start docker
  • build the docker image for the application:
 sudo docker build .

check if the image exists:

 sudo docker images 

or

 sudo docker image ls
  • Run the image

Useful links