on 2020 Jan 28 9:01 PM
Hey guys! So basically I have my cat-service.cds file which looks like this
---cat-service.cds---
service CatalogService @(requires: 'authenticated-user'){
entity Books as projection on mydb.BOOKS
entity Movies as projection on mydb.MOOVIES
}
---cat-service.js---
module.exports = cds.service.impl(srv => {
srv.on("CREATE", "Books", async(req) => {
}
}<br>
It works perfectly fine like this, but right now I'm trying to add just a simple express middleware. (for the @sap/logging library to register a logger )
Technically I should have access at srv.use inside the cds.service.impl, but apparently I don't
Does anyone have any idea on how I can register it?
Request clarification before answering.
Hi Catalin,
if you look at the usage of cds.serve as described here, you will notice that an express app is manually instantiated here. This should give you the possibility to register anything on the app that you like.
Hope that helps!
Best regards,
Dennis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But you don't want to register stuff on the srv, don't you? You want to register it on the app? Basically like this:
const app = require('express')();
//register middleware
app.use(somethingSomethingMiddleware)
//cds serve
cds.serve("BookService")
...
.in(app)
.with(srv => {
srv.on("CREATE", "Books", async(req) => {
...
}
})
User | Count |
---|---|
79 | |
21 | |
8 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.