Skip to content

Latest commit

 

History

History
 
 

grangular

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

GrAngular

Demo app to showcase Grails's end-to-end reactive capability.

RxJS(Angular) -> Reactive Controller -> RxGORM -> MongoDB

Features

  1. Showcase how Grails can be used for Multi-Tenancy, Resiliency and Reactive
    • SaaS style REST APIs
    • Multi-Tenancy Modes: DISCRIMINATOR
    • RxGORM with MongoDB
    • CORS Enabled
    • Reactive Controller
    • RxGORM with MongoDB
    • Custom Properties
    • Custom Banner
  2. Single Page Application(SPA) front-end app.
    • Angular 1.5
    • Angular 2.0
    • Authentication: JWT, Auto Token Refresh - RememberMe, AuthInterceptor - 401,203,419,440
    • Layout - spinner, bootstrap theme
    • Notifications
    • Authorization

Setup

  1. Make sure MongoDB is running
  2. Make sure Trust Broker is running
  3. Start GrAngular Grails App

Run

cd grangular
grails
grails> run
Grails application running at http://localhost:8080 in environment: development
grails> stop

Test

To get a token, make a request to the Trust Broker's login endpoint:

# For ROLE_USER
curl -i -H "Content-Type: application/json" --data '{"username":"basic3","password":"basic123"}' 0:9080/api/login
# For ROLE_ADMIN
curl -i -H "Content-Type: application/json" --data '{"username":"admin","password":"admin123"}' 0:9080/api/login

Verify access_token with https://jwt.io/

default secret : qrD6h8K6S9503Q06Y6Rfk21TErImPYqa

Copy the access_token part of the response, and make a request to the GrAngular's todos endpoint, passing the token in the header:

# Try with ROLE_USER token
curl -i -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...." 0:8080/api/todos
# Try with ROLE_USER token or ROLE_ADMIN token
curl -i -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...." 0:8080/api/test
# Try with ROLE_ADMIN token
curl -i -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...." 0:8080/api/books
# Try with no token
curl -i  0:8080/api/guest/stream
curl -i  0:8080/api/guest/application

Build

Deploy