In the main.ts In common/validators/custom-validations.ts Output response on input validation of DTO:
Many times we feel the need to have another GSI to an exiting table like we need to order the query result by updatedAt column. In DynamoDB that is possible without destroying the existing table. This is how to do it. Make sure you have aws-cli installed on your system and credentials configured. Create a …
Continue reading “Add new Global Secondary Index (GSI) to an existing DynamoDB table”
If you are using Sequlizejs for working with Postgres or MySQL with foreign key columns not set in the model definition like shown below: and you try to use create or bulkCreate on the model by providing the values of all fields including foreign key column like: Then it must be failing to insert proper …
Continue reading “Why Sequelizejs is inserting null for foreign key field?”
One of the reasons for this issue can be the order of statements. E.g, if you have mocked a module at line #5, but there are some other require statements at line #1,2,3,4, then it may be the case that the same module is used in those required modules (at line #1,2,3,4).
As PostgreSQL documentation, we can update the user using this command syntax: So, if we have a user in named john and we want to update the password, we have to run this command in psql prompt
Many times there are cases when we have to use delay some functionality in javascript and the function we use for this is setTimeout(). in regular functions it works vey well and does its job, however, it becomes tricky to delay an async function using setTimeout like this: This will not work as you will …
Continue reading “How to use setTimeout with async/await in Javascript”
I spent good amount of time last week to figure out how to make Expressjs app to listen on a specific port (say, 3005) for one of the projects. Regular PM2 setup involves creating a new config block in the ecosystem file. This works for regular nodejs app, however, if your APIs are using expressjs …
Continue reading “PM2 (Node.js) not listening on specific port for Expressjs app/api”
Using LESS or SASS has become the de facto standard for front end development and React is the preferred frontend framework these days. A question is asked frequently on how we can enable LESS/SASS/STYLUS in React project. The easiest way to do it is using custom-react-scripts. This adds the support for SASS/LESS/STYLUS and decorators in …
Continue reading “How to use LESS preprocessor in React’s create-react-app”
If you are using custom callback for authentication using PassportjsĀ for Local Database Authentication, you may encounter the situation that the Post request hangs and the authentication never seems to end. There may be many reasons but what we’ve found most common is we are using passport.authenticate() middleware in a callback but do not provide (req, …
Continue reading “Why Passport with Local Strategy is hanging on Authentication”
You probably won’t need to do this often, but just in case you happen to, here is how to delete a tag from a remote Git repository. If you have a tag named ‘tag123’ then you would just do this: This will remove ‘tag123’ from the remote repository.