Skip to content
Advertisement

Tag: express

Node.js response API vs. Express.js response API

Both, Node.js and Express.js have response API. And it looks like there is even some overlapping between them, e.g.: Node.js: response.write(chunk[, encoding][, callback]) Express.js: res.attachment([filename]) res.download(path [, filename] [, options] [, fn]) res.sendFile(path [, options] [, fn]) res.send([body]) Which response API should be used for sending a response (e.g. JSON, files)? In other words, should I use response.write by Node.js

ExpressJS: Adding routes dynamically at runtime

I want to be able to add new routes at runtime without restarting the server with NodeJS & ExpressJS. I made a similiar approach like in this article: https://alexanderzeitler.com/articles/expressjs-dynamic-runtime-routing/Technically I’m able to add new files and logic at runtime likewise in the article, but the problem is that when no api route was matched I’ll send a 404 JSON respond

ExpressJS: Adding routes dynamically at runtime

I want to be able to add new routes at runtime without restarting the server with NodeJS & ExpressJS. I made a similiar approach like in this article: https://alexanderzeitler.com/articles/expressjs-dynamic-runtime-routing/Technically I’m able to add new files and logic at runtime likewise in the article, but the problem is that when no api route was matched I’ll […]

Connecting JavaScript with Django

I want to connect Django with JavaScript because I know a few tools that will help me with my applications and they work best with JavaScript I want to take all the urls and redirections with python and Django but I want some features working with JavaScript and possibly I might want to even want to connect my database with

ExpressJS: run a function every 24 hours

What’s the easiest way to run an automated function every 24 hours in ExpressJS? I have searched everywhere for a solution aside from running an infinite loop. Is this in principle the only way to do it? Answer you need to use node-cron npm get other cron formula :https://crontab.guru/examples.html

How to format datetime in EJS?

enter image description here I am trying to achieve the datetime format like this 1:00 am May 11 2020? I am using mongoDB and EJS How can I do it in my code? Here is my server.js code: And here’s my EJS template: How can can I achieve that format in my code??????????? I appreciate all the answers thank you

Start and stop server with supertest

I have the following server class : I’m using supertest for end-to-end testing. I wish to start my application beforeAll tests and stop it when the tests are done. It’s easy to do that using beforAll and afterAll where I can just once instanciate the Server class and call the start and close methods. But as I have 10+ controllers

Advertisement