Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
Are there any advantages of http.server() over Express.js

Express framework is so huge, are there any cases where I should prefer http.createServer() over Express .get and .post?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

express seems rather tiny to me, compared with other packages.

One use case where even this package seems not justified is if I have to start up an http server only for one interaction, such as authenticating a desktop app with OAuth 2.0 with localhost as the loopback URI.

The following code snippet illustrates this, and also shows that code = req.query.code (which would be possible with express) must be replaced with something lengthier:

var oAuth2Client = new google.auth.OAuth2(...);
var loopback = http.createServer(function(req, res) {
  var code = new URL("http://" + req.url).searchParams.get("code");
  if (code) {
    oAuth2Client.getToken(code, (err, token) => {
      oAuth2Client.setCredentials(token);
      res.end();
    });
    loopback.close();
  }
}).listen(...);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!