Comments (2)
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.
from kurier.
@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.
/* eslint-disable @typescript-eslint/require-await */
import { HasId, Operation, OperationProcessor, Resource } from 'kurier';
/**
* Preprocessor for firebase.
*/
export class FirebaseProcessor<TResource extends Resource> extends OperationProcessor<TResource> {
async get(op: Operation): Promise<HasId[] | HasId> {
if (op.ref.id) {
return await this.getOne(op);
}
return this.getMany(op);
}
protected async getMany(op: Operation): Promise<HasId[]> {
return [
{
// ...just testing data
},
{
// ...
},
];
}
protected async getOne(op: Operation): Promise<HasId> {
const data: HasId = {
id: op.ref.id,
// ...
};
return data;
}
async remove(op: Operation): Promise<void> {
throw new Error('Method not implemented.');
}
async update(op: Operation): Promise<HasId> {
throw new Error('Method not implemented.');
}
async add(op: Operation): Promise<HasId> {
throw new Error('Method not implemented.');
}
}
from kurier.
Related Issues (20)
- Expose route map for operations & processors HOT 1
- `include` brings duplicates if multiple entities reference same related entity
- `include` brings unrelated resources
- Add `meta` to operation responses, both at resource-level and document-level
- Question: how access context / req data in Processors and apply global scopes?
- Expose `http-utils` to allow custom middleware implementations HOT 3
- Transport layer context availability in ApplicationInstance HOT 1
- Cannot remove BelongsTo relationship using PATCH with relationship URL
- Ability to register custom attribute types (like Password), with serialize/deserialize hooks HOT 1
- Support for using a custom SessionProcessor and SessionResource in UserManagementAddon
- Helper functions for describing relationships
- Upgrade to TypeScript 5
- WebSocket middleware isn't returning errors as its HTTP counterparts
- Add test suite for WebSockets
- Add Node 20.x for CI pipeline HOT 3
- Add IS NULL, IS NOT NULL filters HOT 1
- [1.3.x] errors.status should be a string
- Support multiple filters for the same attribute
- Support alternate filter parsers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kurier.