Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

express

TypeError: Cannot read property ‘push’ of undefined -Express

April 12, 2024 by Tarik

My problem was missing parentheses: const router = require(‘express’).Router; Changing this to const router = require(‘express’).Router(); solved my problem.

Categories javascript Tags express, javascript, node.js Leave a comment

TypeError: exphbs is not a function

April 12, 2024 by Tarik

You should use “exphbs.engine” instead of “exphbs”. app.engine(‘.hbs’, exphbs.engine({ extname: ‘.hbs’, defaultLayout: “main”}));

Categories javascript Tags express, express-handlebars, javascript, node.js Leave a comment

Creating methods to update & save documents with mongoose?

April 12, 2024 by Tarik

From inside a static method, you can also create a new document by doing : schema.statics.createUser = function(callback) { var user = new this(); user.phone_number = “jgkdlajgkldas”; user.save(callback); };

Categories node.js Tags express, methods, mongodb, mongoose, node.js Leave a comment

Why does req.params return an empty array?

April 11, 2024 by Tarik

req.params can only get the param of request url in this pattern:/user/:name req.query get query params(name) like /user?name=123 or body params.

Categories node.js Tags express, node.js Leave a comment

Express + Postman, req.body is empty

April 11, 2024 by Tarik

After spending a few hours I realized need to change the Raw type in postman to JSON

Categories node.js Tags express, node.js, postman Leave a comment

fetch() POST request to Express.js generates empty body {}

April 10, 2024 by Tarik

Add the following line in addition to your current bodyParser app.use() right before: app.use(bodyParser.json()); This will enable bodyParser to parse content type of application/json. Hopefully that helps!

Categories javascript Tags body-parser, express, fetch-api, javascript Leave a comment

Is there any way to use multiple view engines with Express + Node.js

April 10, 2024 by Tarik

Add both engines and consolidate.js in your package.json In yourapp.js var engines = require(‘consolidate’); app.engine(‘jade’, engines.jade); app.engine(‘handlebars’, engines.handlebars); More info here

Categories node.js Tags express, handlebars.js, node.js, pug, viewengine Leave a comment

How to connect to mongoDB Atlas using mongoose

April 10, 2024 by Tarik

The answer in this related post is correct. You should: not mix options with connection string (if done so) make sure your IP you are running on is whitelisted and your network allows connections to Atlas make sure the user has sufficient permissions use the connection string as is provided by atlas and just provide … Read more

Categories node.js Tags express, mongodb, mongodb-atlas, node.js Leave a comment

Do I have to use express in Next.js project?

April 9, 2024 by Tarik

You do not need to use express, Next JS already has its own built-in server. However since express is popular, it is easier for developers to communicate with databases or handle other backend work.

Categories javascript Tags express, javascript, next.js, node.js, server-side-rendering Leave a comment

NodeJS Postgres error getaddrinfo ENOTFOUND

April 9, 2024 by Tarik

If you’re sure your connection string is already well-formed like the one gnerkus described, the last thing you need to check is your password. If it’s contain non alphanumeric characters, maybe that’s the one who cause the issue. It seems either the Node.js or the way javascript work itself causing this (I’m not really sure … Read more

Categories javascript Tags express, javascript, postgresql Leave a comment
Older posts
Page1 Page2 … Page77 Next →

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa