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

298
Views
Why Isn't My NodeJS Post Request Working? (From Django)

I am trying to send a request that I'm receiving in my Django view to my expressjs api on the same server and I am either getting 500 errors or empty response bodies on the express end.

Here is my express.js code:

var express = require('express');
var fs = require('file-saver');
var app = express();
var multer  = require('multer');
var upload = multer({ dest: 'json/' });
const router = express.Router();
const bodyParser = require('body-parser');
//app.use(express.static('public'));
app.use(bodyParser.urlencoded({ extended: true }));

app.get('/example', function (req, res) {
  res.send('Hello World!');
});

app.post('/example', async (req, res) => {
    await fs.saveAs(req.body, 'json.json');
    await console.log('Got body:', req.body);
    await res.sendStatus(200);
});

app.listen('8080', function () {
    console.log('Test');
});

Here is my django view:

from django.http import HttpResponse
from django.core.mail import EmailMessage, send_mail
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from django.http import FileResponse
from rest_framework.decorators import api_view
import json
from reportsappapi.utilities import logip
import requests

@method_decorator(csrf_exempt, name='dispatch')
@api_view(['GET', 'POST'])
def sendMail(request):
    url = 'https://example.com/example'
    clockout = request.FILES['clockout']
    clockoutJSON = json.load(clockout)
    x = request.post(url, clockout)
return HttpResponse(status=204)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

enter image description here

enter image description here

Extra "s". as Arun pointed it out

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!