xc-core
v0.3.0
Published
Base files of xgenecloud that create REST & GraphQL APIs for any database.
Downloads
26
Readme
Install & setup
API Reference
Classes
BaseMiddlewareGql
Base class for middlewares
Kind: global class
- BaseMiddlewareGql
- .default(req, res, next) ⇒ Promise.<void>
- .isAllowed(roles, method, permissions, resolver) ⇒ boolean
baseMiddlewareGql.default(req, res, next) ⇒ Promise.<void>
Kind: instance method of BaseMiddlewareGql
| Param | | --- | | req | | res | | next |
baseMiddlewareGql.isAllowed(roles, method, permissions, resolver) ⇒ boolean
Kind: instance method of BaseMiddlewareGql
| Param | Type | Description | | --- | --- | --- | | roles | Object | Key value pair of role and true/false | | method | String | query/mutation | | permissions | Object | Refer permissions in *.policy.js | | resolver | function | Resolver function |
BaseResolver
Base class for graphql resolver
Kind: global class
baseResolver.mw([Function[]], cbk) ⇒ function
Kind: instance method of BaseResolver
| Param | | --- | | [Function[]] | | cbk |
BaseMiddleware
BaseMiddleware used for REST APIs module
Kind: global class
- BaseMiddleware
- new BaseMiddleware(app)
- .default(req, res, next) ⇒ Promise.<void>
- .isAllowed(roles, method, permissions, url) ⇒ Promise.<boolean>
new BaseMiddleware(app)
| Param | Type | Description | | --- | --- | --- | | app | Object | app context |
baseMiddleware.default(req, res, next) ⇒ Promise.<void>
Default middleware function that gets invoked
Kind: instance method of BaseMiddleware
| Param | Type | Description | | --- | --- | --- | | req | Object | express req object | | res | Object | express res object | | next | function | express next function |
baseMiddleware.isAllowed(roles, method, permissions, url) ⇒ Promise.<boolean>
Determines if the method is allowed for a particular request,url and role
Kind: instance method of BaseMiddleware
| Param | Type | Description | | --- | --- | --- | | roles | Object | key value pair with role and true/false | | method | String | HTTP Method name | | permissions | Object | refer to permission in *.policy.js | | url | String | http url |
BaseRouter
BaseClass for Router files in REST APIs
Kind: global class
new BaseRouter(app)
| Param | Type | Description | | --- | --- | --- | | app | Object | app context |
BaseService
BaseClass for service files in REST APIs module
Kind: global class
BaseComponent
Base class for a component in server
Kind: global class
baseComponent.init()
Initialisation method of component - mandatory to be implemented by the child class
Kind: instance method of BaseComponent
Components
Class to keep reference of all components in server
Kind: global class
- Components
- new Components(components, baseDir)
- .init() ⇒ Promise.<void>
new Components(components, baseDir)
| Param | Type | Description | | --- | --- | --- | | components | Object | details of components | | baseDir | String | base directory |
components.init() ⇒ Promise.<void>
Initialise all component of server
Kind: instance method of Components
test