Open nelson6e65 opened 11 months ago
Hey @nelson6e65! Thank you for reporting this. Type names are expected to be singularized for the router to work.
Can you share your app.ts
file? In particular, the app
instantiation. This might be a problem related to how the resource is being registered.
@joelalejandro Sure! Here you are!
// server.ts
import express from 'express';
import { jsonApiExpress, Application } from 'kurier';
import { FirebaseProcessor } from '~api/v1/processors/firebase.processor';
import { Tenant } from '~api/v1/resources/tenant';
import { User } from '~api/v1/resources/user';
import { JsonApiApplication } from '~utils/json-api/json-api-application';
const app = new Application({
types: [
//
User,
Tenant,
],
defaultProcessor: FirebaseProcessor,
});
const server = express();
server.use(
jsonApiExpress(app, {
httpStrictMode: true,
})
);
export default server;
My FirebaseProcessor
it just extends OperationProcessor
, I have not done anything yet.
When I use
GET /tenants
, I getType should be
'tenants'
, not'tenant'
. πThat's why it does not find the resource.
On this line of
convertHttpRequestToOperation
function, it is hard-coding the type, converting it to singular camel-case version: https://github.com/kurierjs/kurier/blob/9874656ead05e645e699fe518f96a6de1c2815ab/src/utils/http-utils.ts#L78C48-L78C48