To enable the module, make sure you have a server configuration as documented.
Then, simply attach the ResourceServer middleware to your express app.
import express, { Application } from "express";
import ResourceServer, { ServerConfig, Event, Events, Notifications, Storage, Datasource } from "@ssofy/express-server";
import cors from "cors";
...
// CORS is necessary for testings endpoints via SSOfy Panel's Endpoint Tester
app.use(cors());
// Enable JSON Request/Response
app.use(express.json());
// Server Config
const serverConfig: ServerConfig = {
...
};
// Resource Server
app.use(ResourceServer(serverConfig));
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
You should now have access to the endpoints described in routes page.