Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I just installed Node JS on my ec2 instance (server) using the following site...http://iconof.com/blog/how-to-install-setup-node-js-on-amazon-aws-ec2-complete-guide/
I followed the instructions and I believe I downloaded it all properly, now I am trying to implement Node, but I do not think I am doing it right. I tried tutorialspoint.com but still cannot get it to work.
Basically I am using AJAX when a button is clicked, which in turn calls my node file...
$('#savePic').click(function(e) { $.ajax({ url: "signupServer.js", type:'POST', data: new FormData($('#formpic')[0]), contentType: false, processData: false }).done(function(){
and my node js file looks like this...
var http = require("http"); var fs = require("fs"); http.createServer(function (request, response) { fs.writeFile("var/www/html/uploads/test", "Hey there!", function(err) { if(err) { return console.log(err); } console.log("The file was saved!"); });
I am not using any of the POST data as referenced in my AJAX, I am simply using AJAX to call the code written in my signupServer.js.
POST
signupServer.js
The node js file above simply writes "Hey there!" to a file called test located at /var/www/html/uploads/test, but I cannot get it to work. I don't think anything is happening when the button savePic is clicked. Am I using node wrong here?
"Hey there!"
/var/www/html/uploads/test
savePic
You've got most of the pieces, but went wrong in a couple places.
You need to run the node file as a server. In your AJAX you call the the URL to hit the node server.
Using AWS(ec2) makes this a little more complicated. Your fist step should be to get a "hello world" node app running(there should be listen function in your Node server code) on AWS and successfuly pull up the app in your browsers. If you are new to AWS, this can take some time to figure out Once you get here, I think you will see how to change your code above.
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.