@spruceid/ssx-serverless
v1.2.3
Published
Create SSX applications in serverless architectures
Downloads
27
Keywords
Readme
SSX Serverless
ssx-serverless
is a serverless version of ssx-server
. It's intended to make it easier to be used in this kind of architecture.
Installing
npm install --save @spruceid/ssx-serverless
# OR
yarn add @spruceid/ssx-serverless
Building
npm run build
# OR
yarn build
Usage
The library exports a main class SSXServer
which is supposed to be used as a Singleton. A basic configuration for this class would look like the following:
import {
SSXServer,
SSXRPCProviders,
SSXInfuraProviderNetworks,
} from '@spruceid/ssx-serverless';
const _create = async <T>(value: any, opts?: Record<string, any>): Promise<T> => {
return dynamoDb.put(value).promise() as T;
};
const ssx = new SSXServer({
providers: {
rpc: {
service: SSXRPCProviders.SSXInfuraProvider,
apiKey: process.env.INFURA_ID,
network: SSXInfuraProviderNetworks.GOERLI,
}
}
}, {
create: _create,
retrieve: _retrieve,
update: _update,
delete: _delete,
});
For more information see the example.