error TS2792: Cannot find module ‘moment’. Did you mean to set the ‘moduleResolution’ option to ‘node’, or to add aliases to the ‘paths’ option?
Got this error when trying to import moment
into a TypeScript React (.tsx) module?
Got this error when trying to import moment
into a TypeScript React (.tsx) module?
It shouldn’t be hard to detect a user’s country based on the IP address, right? Right… I really liked the simplicity of ip2location
module: load the BIN file, get the location, and close the BIN file.
Detect user country by IP in Node.js Read More »
This error message appears when typings are exposed globally, yet TypeScript tries to validate module typings and the names conflict.
…Can you make an HTTP/3 request with Node.js? I asked that question on OpenAI’s playground to see how it handles the question that doesn’t have the answer.
…EventSource is a handy API supported by all browsers, which runs over the regular HTTP protocol and doesn’t require setting up a separate WebSocket service. However, it has limitations, such as data being one-directional (server to client) or a connection being constantly occupied. Let’s dive in.
…Push instant updates with EventSource API Read More »
Node.js can be used to easily run a web server by using the built-in HTTP module or a web framework such as Express, Hapi, or Fastify. The process involves creating an HTTP server, setting up routes, and starting the server to listen on a specific port for incoming requests.
…5 ways to create an HTTP/HTTP2 server with Node.js.Read More »
5 ways to create an HTTP/HTTP2 server with Node.js. Read More »
One of the easiest ways to convert all JPG and PNG images in a folder to WEBP and AVIF is to use the Sharp library.
…Convert all JPGs and PNGs in a folder to WEBP and AVIF with Node.js and SharpRead More »
Convert all JPGs and PNGs in a folder to WEBP and AVIF with Node.js and Sharp Read More »
Being from early JavaScript days, you might’ve been used to setting a timeout
for all your HTTP requests in jQuery or libraries like axios, request, etc. Yet to your surprise, there’s no timeout
parameter for native browser’s fetch
.
fetch() with timeout Read More »
You might have had this while using the CSS columns
rule and getting rid of all those JavaScript libraries. One of the elements got suddenly cut and wraps to the next column.
Prevent CSS column break within an element Read More »
FFmpeg is an awesome tool that can convert not only videos but also audio and images.
…Convert all PNGs in a folder to WEBP with FFmpeg Read More »