I have hosted a little web app on heroku. My issue is when I try to execute a php file from angularjs, the console log says me that can't found it. On my localhost works perfectly! Here is the code.
From the controller (app.js):
$http({
method: 'POST',
url: 'generarPDF.php',
data: misProductos,
}).
then(function(response){
alert(response.data);
})
My php just receive the data and send it by mail. The controller file and the php file are in the same directory. The node server:
var app = express();
app.use(express.static(path.join(__dirname)));
app.get('/', function(req, res){
res.sendFile(path.join(__dirname + '/admin_3/index.html'));
});
app.get('/page_general_portfolio_3.html', function(req, res){
res.sendFile(path.join(__dirname + '/admin_3/page_general_portfolio_3.html'));
});
app.get('/page_general_about.html', function(req, res){
res.sendFile(path.join(__dirname + '/admin_3/page_general_about.html'));
});
app.get('/form_controls_md.html', function(req, res){
res.sendFile(path.join(__dirname + '/admin_3/form_controls_md.html'));
});
app.get('/ecommerce_products_edit.html', function(req, res){
res.sendFile(path.join(__dirname + '/admin_3/ecommerce_products_edit.html'));
});
This is the heroku log:
2018-01-31T00:00:41.789571+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2018-01-31T00:00:41.867855+00:00 heroku[web.1]: Process exited with status 143 2018-01-31T00:00:51.631278+00:00 heroku[web.1]: Starting process with command
npm start
Thanks in advance!
What port are you using? you need to use
app.listen(process.env.PORT | 1234, ()=> console.log());
process.env.PORT don't forget this
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.