marvelous
the marvelous framework - microservices for node.js
Sample Application
Task Service
This RPC service reads/writes tasks for a to-do list:
Tip: this service is accessible via http://localhost:4000
;taskService.start;
Public Gateway
This REST gateway exposes the Task Service functionality:
Tip: this service is accessible via http://localhost:3000
;publicGateway.start;
API Reference
Gateway
Properties
Name | Example |
---|---|
environment string
the gateway environment
|
"production"
|
enableLogging string
enables gateway logging
|
true
|
knownErrors GatewayError[]
an array of gateway errors
|
[ AuthServiceError ]
|
onLoad Function
fires when gateway is loaded
|
|
onStart Function
fires when gateway is started
|
|
onStop Function
fires when gateway is stopped
|
|
routes GatewayRoute[]
an array of gateway routes
|
[ UsersRoute ]
|
url string
the gateway url
|
"http://localhost:3000"
|
GatewayError
Properties
Name | Example |
---|---|
code number
the error status code
|
401
|
name string
the error name
|
"AuthGatewayError"
|
message Function
the error message
|
"You must be logged in."
|
GatewayMethod
Properties
Name | Example |
---|---|
handler Function
the gateway method handler
|
|
schema object
the gateway method schema
|
GatewayRoute
Properties
Name | Example |
---|---|
uri string
the gateway route uri
|
"/users"
|
delete GatewayMethod
DELETE method
|
DeleteUserMethod
|
get GatewayMethod
GET method
|
GetUsersMethod
|
options GatewayMethod
OPTIONS method
|
OptionsUsersMethod
|
patch GatewayMethod
PATCH method
|
PatchUserMethod
|
post GatewayMethod
POST method
|
PostUsersMethod
|
put GatewayMethod
PUT method
|
PutUserMethod
|
Service
Properties
Name | Example |
---|---|
calls object
the service calls
|
{ createUser: CreateUserCall }
|
environment string
the service environment
|
"production"
|
enableLogging string
enables service logging
|
true
|
onLoad Function
fires when service is loaded
|
|
onStart Function
fires when service is started
|
|
onStop Function
fires when service is stopped
|
|
url string
the service url
|
"http://localhost:3000"
|
ServiceCall
Properties
Name | Example |
---|---|
handler Function
the service call handler
|
|
schema object
the service call schema
|
ServiceError
Properties
Name | Example |
---|---|
name string
the error name
|
"AuthGatewayError"
|
message Function
the error message
|
"You must be logged in."
|