The coding conventions are elaborated throughout the documentation. It’s imperative to adhere to the prescribed folder structure, naming conventions, and comments. Good code documentation is crucial and non-negotiable.For every endpoint, API documentation must be included to facilitate the creation of OpenAPI documentation.Here are a few other key points:
Utilize TypeScript as the Primary Programming Language
TypeScript brings static typing to JavaScript, ensuring more robust and error-free code. Below is a basic example demonstrating a class definition in TypeScript
Copy
class Person { constructor(private name: string, private age: number) {} public sayHello(): void { console.log(`Hello, my name is ${this.name} and I am ${this.age} years old.`); }}
Using named arguments makes your code more readable and self-documenting. It also makes your functions more flexible to changes in the order of arguments.
Leverage the GenericCrudService Class for Default CRUD Operations
The GenericCrudService class streamlines the creation of basic CRUD operations for MongoDB documents. Ensure to extend this class when creating services for new schemas.
Copy
import { GenericCrudService } from 'path-to-generic-crud-service';import { User } from './user.model';class UserService extends GenericCrudService<User> { constructor() { super(User); }}
Always refer to the documentation for predefined methods that can expedite your development process. Adhering to the provided methodologies ensures consistency across the codebase and facilitates collaborative development efforts.