CoreUI ONE — 250+ PRO components and 25+ admin templates for React, Angular, Vue, Bootstrap and Next.js, plus Data Grid, Scheduler, 4,300+ PRO icons and the Next.js boilerplate. One license. → See what you get

How to use Yup for validation in Node.js

Yup is a JavaScript schema validation library that provides intuitive API for validating objects with excellent TypeScript support. As the creator of CoreUI, I’ve used Yup to validate API requests in applications serving millions of users, appreciating its chainable API and built-in type inference that catches validation errors at compile time.

The most effective approach uses Yup schemas with Express middleware for consistent validation.

Read More…

How to use TypeORM in Node.js

Using TypeORM in Node.js provides a modern, TypeScript-first Object-Relational Mapping solution with decorators and advanced features for enterprise database management. As the creator of CoreUI with extensive Node.js experience since 2014, I’ve implemented TypeORM in numerous enterprise applications requiring type-safe database operations and complex relational data modeling. The most effective approach involves defining entities with decorators, configuring database connections with migration support, and using repositories for data access patterns. This method provides compile-time type safety while offering advanced features like lazy loading, cascade operations, and automatic schema synchronization.

Read More…

Why does querySelectorAll in TypeScript return Element instead of HTMLElement?

Why does querySelectorAll in TypeScript return Element instead of HTMLElement

Understand why querySelectorAll in TypeScript is typed as Element, how it relates to the DOM spec, and the right way to work with HTMLElement arrays in your code.

Read More…

How to fix “SyntaxError: Cannot use import statement outside a module”?

How to fix “SyntaxError: Cannot use import statement outside a module”?

In your development journey, encountering errors is a norm, but some can leave you scratching your head. One such instance is when you’re met with “Cannot use import statement outside a module” in JavaScript. This error can be a hurdle, but with the right guidance, you can overcome it easily. In this article, we’ll explore the why and how of fixing this common issue, equipping you with the tools to continue coding without interruptions.

Read More…
Subscribe to our newsletter
Get early information about new products, product updates and blog posts.