Skip to content

lahiru99/Todo_App_A3

Repository files navigation

Simple Todo App with MongoDB, Express.js and Node.js

The ToDo app uses the following technologies and javascript libraries:

  • MongoDB
  • Express.js
  • Node.js
  • express-handlebars
  • method-override
  • connect-flash
  • express-session
  • mongoose
  • bcryptjs
  • passport
  • docker & docker-compose

What are the features?

You can register with your email address, and you can create ToDo items. You can list ToDos, edit and delete them.

How to use

First install the depdencies by running the following from the root directory:

npm install --prefix src/

To run this application locally you need to have an insatnce of MongoDB running. A docker-compose file has been provided in the root director that will run an insatnce of MongoDB in docker. TO start the MongoDB from the root direction run the following command:

docker-compose up -d

Then to start the application issue the following command from the root directory:

npm run start --prefix src/

The application can then be accessed through the browser of your choise on the following:

localhost:5000

Container

A Dockerfile has been provided for the application if you wish to run it in docker. To build the image, issue the following commands:

cd src/
docker build . -t todoapp:latest

Terraform

Bootstrap

A set of bootstrap templates have been provided that will provision a DynamoDB Table, S3 Bucket & Option Group for DocumentDB & ECR in AWS. To set these up, ensure your AWS Programmatic credentials are set in your console and execute the following command from the root directory

make bootstrap

To instantiate and destroy your TF Infra:

To instantiate your infra in AWS, ensure your AWS Programattic credentials are set and execute the following command from the root infra directory:

make up -e ENV=<environment_name>

Where environment_name is the name of the environment that you wish to manage.

To destroy the infra already deployed in AWS, ensure your AWS Programattic credentials are set and execute the following command from the root directory:

make down -e ENV=<environment_name>

Testing

Basic testing has been included as part of this application. This includes unit testing (Models Only), Integration Testing & E2E Testing.

Linting:

Basic Linting is performed across the code base. To run linting, execute the following commands from the root directory:

npm run test-lint --prefix src/

Unit Testing

Unit Tetsing is performed on the models for each object stored in MongoDB, they will vdaliate the model and ensure that required data is entered. To execute unit testing execute the following commands from the root directory:

npm run test-unit --prefix src/

Integration Testing

Integration testing is included to ensure the applicaiton can talk to the MongoDB Backend and create a user, redirect to the correct page, login as a user and register a new task.

Note: MongoDB needs to be running locally for testing to work (This can be done by spinning up the mongodb docker container).

To perform integration testing execute the following commands from the root directory:

npm run test-integration --prefix src/

#bootstrap templates make bootstrap Bootstrap screenshots

#S3 buckets have been built S3 buckets screenshots

#In infra folder terrafom apply is done to configure the backend #make init make init screenshots

#vpc VPC screenshot

#updated the KOPS in config.yml #contrainer repo Container Repo screenshots

#terrafmom apply terrafmom apply screenshot 1 terrafmom apply screenshot 2

#Deploy your kubernetes cluster #make kube-deploy-cluster KOPS cluster

#B)c. Environment variables are set in your CircleCI Project variables circel ci apply screenshots 2

#HELM chart

This project is licensed under the MIT Open Source License