DevByDJ / Node-Server-Jest

Simple Server creatomg using Node and Express JS with TDD
MIT License
0 stars 0 forks source link

Node-Server-Jest

Register Page (prototype) Register Login Page Login Dashboard dashboard

Login Application

This application is a simple login system built using Node.js and Express.js. It allows users to register and login, and once logged in, they are taken to a dashboard.

The application uses MongoDB as its database to store registered users. It is built using the following scripts:

Scripts

start

"start": "nodemon server.js"

This script starts the server using nodemon. nodemon is a utility that monitors for any changes in your source and automatically restarts the server.

test

"test": "jest --forceExit --detectOpenHandles --watchAll --maxWorkers=1"

This script runs the test suite for the application using jest. jest is a testing framework for JavaScript. The --forceExit flag is used to force Jest to exit after all tests have completed. The --detectOpenHandles flag is used to exit the process with an error code if the process has active handles that are preventing it from exiting. The --watchAll flag is used to run the test suite in watch mode, and the --maxWorkers flag is used to specify the maximum number of workers the worker-pool should spawn for running tests.

Installation

To install and run this application on your workstation, follow the steps below:

  1. Make sure you have Node.js and MongoDB installed on your machine.

  2. Clone the repository to your local machine:

git clone https://github.com/DevByDJ/Node-Server-Jest.git

  1. Navigate to the project directory:
cd Node-Server-Jest
  1. Install the dependencies:

    npm install
  2. Create a file named .env in the root of the project and set the following environment variables:

    PORT=3000
    MONGODB_URI=mongodb://localhost/Node-Server-Jest
  3. Start the server:

    npm start
  4. Open a web browser and navigate to http://localhost:3000 to access the application.

Testing

To run the test suite for this application, use the following command:

npm test