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

139
Views
La aplicación Heroku no reconoce/lee myfile.txt

Acabo de implementar mi aplicación en heroku, ¿no se reconoce/lee mi archivo txt? y funciona perfectamente bien en mi máquina local. ¿Hay alguna razón para ello? esta es la estructura de los documentos:

 -app -css -files --myfile.txt -js -logo -views -index.html -app.js -composer.json -package-lock.json -package.json -Procfile

esta es mi aplicación.js:

 const express = require('express'); const PORT = process.env.PORT || '8080'; const path = require('path'); const app = express(); app.use(express.static(path.join(__dirname, 'app'))); app.get('/', (req, res) => res.render('index')); app.get('/profiles', function(request, response){ response.json( getFileContents() ); }); function getFileContents(){ // Buffer mydata var BUFFER = bufferFile('./app/files/myfile.txt'); return processData(BUFFER); } //read file function bufferFile(relPath) { var fs = require('fs'); var path = require('path'); return fs.readFileSync(path.join(__dirname, relPath),{ encoding: 'utf8' }); } function processData(contents){ let data = []; contents.split("\r").forEach( line => { let row = line.replace('\n','').split('\t'); data.push( { Name : row[0] || '', City : row[1] || '', Links : row[2] || '' } ) }); return data; } app.set("port", PORT); app.listen(PORT, () => console.log(`Listening on port ${PORT}`));

alguien tiene idea de porque no funciona? Gracias por adelantado

about 4 years ago · Juan Pablo Isaza
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!