Skip to content

Ckabuo/login-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StackUp Backend ExpressJS Part II

Welcome to the login-app project, inspired by StackUp Backend ExpressJS part II campaign! This README provides step-by-step instructions on how to set up and run the project after cloning or downloading it from the GitHub repository.

Table of Contents

  1. Prerequisites
  2. Installation
  3. Environment Variables
  4. Running the Server
  5. Project Structure
  6. Troubleshooting

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have installed Node.js and npm. You can download them from Node.js.
  • You have a MongoDB Atlas account. You can sign up for free at MongoDB Atlas.

Installation

Follow these steps to get your development environment set up:

  1. Clone the repository:

    git clone https://github.com/your-username/StackUp-BackEnd-ExpressJS-Part-II.git
    cd StackUp-BackEnd-ExpressJS-Part-II
  2. Navigate to the project directory:

    cd login-app
  3. Install the dependencies:

    npm install

Environment Variables

You need to set up your environment variables to connect to your MongoDB database and configure other settings.

  1. Create a .env file in the root of the project directory:

    touch .env
  2. Add the following variables to your .env file:

    db_connection="your_mongodb_connection_string"
    PORT=3001
    SESSION_SECRET='your_session_secret'

Replace your_mongodb_connection_string with the connection string from your MongoDB Atlas account, and your_session_secret with a secret string for your session.

Running the Server

  1. Start the server:

    node app.js
  2. Access the application:

    • Open your browser and go to http://localhost:3001.

Project Structure

Here is an overview of the project's structure:

StackUp-BackEnd-ExpressJS-Part-II/
├── login-app/
│   ├── models/
│   │   └── UserModel.js
│   ├── public/
│   │   └── styles.css
│   ├── views/
│   │   ├── dashboard.ejs
│   │   ├── login.ejs
│   │   ├── register.ejs
│   │   └── welcome.ejs
│   ├── .env
│   ├── app.js
│   ├── package.json
│   └── package-lock.json

Troubleshooting

  1. Common Issues:

    • Ensure MongoDB connection string is correct and your IP is whitelisted in MongoDB Atlas.
    • Verify that Node.js and npm are installed correctly.
    • Check the environment variables in the .env file for any missing or incorrect values.
  2. Debugging:

    • Use console.log statements to debug issues.
    • Check the terminal for server logs and errors.
    • Ensure all dependencies are installed correctly by running npm install.
  3. Database Connection Issues:

    • Make sure your MongoDB Atlas cluster is running.
    • Check if your database credentials in the .env file are correct.

If you encounter any issues or have any questions, feel free to open an issue on the GitHub repository. Happy coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published