XDataServer and middleware (CORS)

Hi!


I created a XData server using a datamodule and Xdata components (including XDataServer and TSparkleHttpSysDispatcher component). I then created a WebCore app to access this server, but I have the CORS problem. 

I need to add the middleware, but I can only find examples for TXDataServerModule and not for my code. I don't know where tu put something like:


XDModule.AddMiddleware(TCorsMiddleware.Create);



Where do I put the middleware for the TXDataServer component?
See here, section "Middleware editor":