Skip to content

A sales networking platform integrating Clearbit API to develop sales leads

Notifications You must be signed in to change notification settings

abishr12/lead-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

119 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lead Generator

dependencies Status

Table of Contents

app.listen
Environment Variables
User Authentication
    Passport.js
    Controller
    Routes
    Views
    User Model

app.listen

When server.js is run, it checks to make sure the database is capable of running without errors, then calls app.listen. The server will not start if any errors are caught. The process will terminate and the errors will be logged to the console.

models.sequelize.sync().then(function () {

  console.log('Nice! Database looks fine');
  app.listen(PORT, function (error) {
    if (error) {
      throw Error(error);
    }

    console.log("Running @:", "http://localhost:" + PORT);
  });

}).catch(function (err) {
  console.log(err, "Something went wrong with the Database Update!");
});

Environment Variables

The dotenv is used to reference private data through the server's environment (process.env).

User Authentication

Passport.js

The app utilizes the Passport.js library to handle user authentication. The Passport config directory contains the logic for creating new users, encrypting passwords using the bcrypt package, signing in existing users and validating passwords, also using bcrypt.

Auth Controller

The ./controllers/authctrl file is a set of methods that are exported to handle sign-up, sign-in, detecting if a user is signed-in, and logout.

Auth Routes

In order to run, the routes module requires the following modules:

// Provide access to the Passport module
const authctrl = require('../controllers/authctrl.js');
const passport = require('passport');

// Provide access to the User moddle
var models = require("../models");

Auth Views

The app uses Handlebars for the dashboard, sign-up and sign-in.

User Model

The User model holds the logic for creating and signing in users. The User model contains an ID (primary key), first and last name, email (the username), password, last login, and session status. This data is saved and persisted in the lead_generator database.

About

A sales networking platform integrating Clearbit API to develop sales leads

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •