Register Page (prototype) Login Page Dashboard
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:
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.
To install and run this application on your workstation, follow the steps below:
Make sure you have Node.js and MongoDB installed on your machine.
Clone the repository to your local machine:
git clone https://github.com/DevByDJ/Node-Server-Jest.git
cd Node-Server-Jest
Install the dependencies:
npm install
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
Start the server:
npm start
Open a web browser and navigate to http://localhost:3000
to access the application.
To run the test suite for this application, use the following command:
npm test