Giter Club home page Giter Club logo

oauth's Introduction

Simple Javascript App

This is a simple JavaScrit app written in ES5 to run on node.js

Directory structure

The importanyt files in the project are listed below:

root
  .vscode                  - config for debugging in 'visual studio' code
  .bin
    server                 - bash script to lauch the app called from package.json "scripts"
  controllers
    index.js               - configures controller and routes for project
    callback.js            - call bakc from OAuth (response handling)
    dashboard.js           - dashboard controller
    login.js               - logn controller
    logout.js              - logout controller
    secure.js              - controller to handle user profile / secure page content
  middleware
    auth.js                - authentication checks and redirects
    errors.js              - 404 and Exception handling
    passport.js            - handles all condfiguration for PassportJS and OAuth2Strategy
  public
    img
      logo.png             - 48px x 48px logo used by the plugin
    script
      jquery.feedback.js   - the jquery plugin applied / run after you login
    style
      style.css            - some simple form styles and styles for the plugin
    favicon.ico            - the project favicon
  views
    partials               - after you login I pull in a simple partial view into the profile page

  app.js                   - main application
  config.js                - configuration information for various parts of the app

Installing the Code

The application makes use of various NPM packages, pulled in via the package.json in the project. The assumption is that you are running a node v6.xx.xx (i was running 6.10.3) and npm 3.xx.xx I was ruuning with 3.10.10 I was also running MacOS

To install the development environment, in the folder that you copied this code into, type:

npm install

Running the project

The project is started (by calling the bash script) with NodeMon, which also watches for file updates and restarts the project. I have included a small utility script in package.json to make thsi call for you and its slghtly easier to get going. The bash script basically runs app.js for you but also does a few house keeping checks for used sockets and ports

npm start

Connecting to the dashboard

The server runs on http://localhost:3000 The public dashboard can be loaded by directing your browsers to:

http://localhost:3000/dashboard

Developer Debugging

I have also included the .vscode folder with the appropiate launch.json configuration file to allow you to run and debug through the application using the Visual Studio Code (other debugging/inspect options are available, use what you know best...)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.