Links

Application Structure

Below I will list the general API layout. I will not list all functions just a few to give you an understanding of what you will find in each file.
  • App.js (Entry Point)
  • nodemon.json (environmental variables used for debugging)
    • Controllers
      • stripe-controller.js (Stripe middleware functions)
        • Get Plan Options
        • Get Subscription Status...
      • users-controller.js (User middleware functions)
        • Get Users
        • Get Permissions...
    • Middleware
      • passport.js
        • Facebook Authentication Strategy
        • Google Authentication Strategy
        • JWT Authentication Strategy...
    • Models
      • http-error.js
        • Wrapper for error responses.
      • tenant.js
        • Mongoose Model for Tenants
      • users.js
        • Mongoose Model for Users
    • Routes
      • stripe-routes.js
        • routes to controller methods starting with /api/stripe
      • users-routes.js
        • routes to controller methods starting with /api/users
    • Shared
      • email.js
        • wrapper methods for mailgun transactional emails
      • helper.js
        • method to handle potential tenant name collisions
      • stripe.js
        • wrapper methods for strip operations
          • Cancel Subscription
          • Update Subscription...