SugoiJS
Demo
Git
NPM
Slack
Search…
V4.0
What is SugoiJS?
Get started
Core concept - FP & OOP
@sugoi/cli
Getting started
Configurations
sugoi.json
Commands
Get build configuration
@sugoi/server
Getting started
Modules
Bootstrapping
Define a route (Controller)
Setting services (Injectables)
CRUD Controller
Response handling
Parameters validation
Authorization
Delay module initialization
Hooks
Timeout
Using configuration
@Sugoi/ORM
Getting started
RESTFUL model
Connectable model
Model interface
Lifecycle
Setting CRUD logic
QueryOptions (sort, page, limit)
Model name
Primary key
Data handling
@sugoi/socket
Getting started
Bootstrapping
Binding a function to event
Middlewares
Handling server & namespace
Dynamic event handling
Schema validator
@sugoi/redis
Getting started
Boostrapping
RedisProvider
Pub/Sub
Scripts
@sugoi/core
Getting started
Policies (Filters)
Singleton
Exception
Casting
@Catch - error handling
@PostConstruct()
@Iterable()
@Deprecated
@OnEvent - event handling
Run time decorate ( + JS support)
ComparableSchema
Using configuration
Extra
Full demo
ORM demo
Upgrade to V4
Powered By
GitBook
Boostrapping
Initialize Redis client
​
Initialization
Initialization done by the static method
CreateConnection
of the
RedisProvider
static
CreateConnection
(
connectionConfig
:
IRedisConfig
,
connectionName
:
string
)
:
TRedisProvider
;
Basic
const
redisProvider
=
RedisProvider
.
CreateConnection
({
host
:
"127.0.0.1"
,
port
:
6379
,
isDefault
:
true
});
const
resolvedClient
=
RedisProvider
.
getConnection
();
expect
(
redisProvider
).
toBe
(
resolvedClient
);
// Should be truthy
Using
@sugoi/server
​
@
ServerModule
({
services
:
[
{
provide
:
RedisProvider
.
CreateConnection
({
host
:
"127.0.0.1"
,
port
:
6379
,
isDefault
:
true
}),
useName
:
"RedisService"
}
]
})
export
class
BootstrapModule
{
constructor
(
@
Inject
(
'RedisService'
)
private
_redisService
:
TRedisProvider
)
{
}
}
@sugoi/redis - Previous
Getting started
Next - @sugoi/redis
RedisProvider
Last modified
3yr ago
Copy link
Outline
Initialization
Basic
Using @sugoi/server