Coder Social home page Coder Social logo

auth-demo's Introduction

auth-demo

Authorization sample in node.js

Folder Structure

Convention for folders is:

lib/<feature-name>

Typically up to 4 components will reside in this directory:

  • lib/<feature-name>/<feature-name>.js - contains domain/business logic
  • lib/<feature-name>/model.js - persistence/queries (wrapper on top of mongodb, mongoose, etc.)
  • lib/<feature-name>/schema.js - mongoose schema definition
  • lib/<feature-name>/service.js - rest service that communicates with external systems (gateway)

Examples

  • lib/market-summary/market-summary.js
  • lib/market-summary/model.js
  • lib/market-summary/schema.js
  • lib/market-summary/service.js

Running Tests

requires [email protected]. [email protected] has been released and of course comes cloaked with breaking changes. I'll work to upgrade us to [email protected] as apart of a separate effort.

Integration tests also require a local instance of mongodb (jasmine:integraton:development grunt target).

Initial Setup

$ git clone repourl && cd checkout-dir
$ npm install
$ npm install -g grunt
$ npm install -g [email protected]

Unit Tests (development environment)

NOTE: The jasmine:unit target is a blocking operation.

$ cd checkout-dir
$ grunt jasmine:unit --verbose

If you don't want to do TDD (jasmine:unit blocks and auto runs tests after a source file change), then you can trigger a one time run via jasmine:unit:ci.

Unit Tests (build agent)

$ grunt jasmine:unit:ci --verbose

Integration Tests (development environment)

$ cd checkout-dir
$ grunt jasmine:integraton:development --verbose

Integration Tests (build agent)

$ grunt jasmine:integraton:ci --verbose

The jasmine:integraton:ci target assumes that mongod is running on a remote computer and does not attempt to trigger the start:mongod and stop:mongod targets.

Outstanding Issues

Completed

  • resolve crazy User.current() guy (want to keep business/domain layer away from expressjs) ✔
  • read mongo environment configuration from gruntjs config ✔
  • add test case to ensure at least exactly 1 to 4 preferences are selected ✔

Pending

  • revamp start/stop server logic ✗
  • break grunt tasks into separate files ✗
  • make live call to external web service to replace fake array of preferences (007 may have already done this guy) ✗
  • default selections for user if none saved in database ✗
  • port to branch inside github ✗

Nice To Haves

Completed

  • remove global references to mongoose and User ✔

Pending

  • upgrade to jasmine-node 2.0.0 (fix all breaking changes, beforeAll, afterAll hooks) ✗

auth-demo's People

Contributors

armw4 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.