Hi,
I have installed NodeJs through windows installer.
I have this following program for connecting to MySql db to return records
===================================================
// Include http module,
var http = require('http'),
// And mysql module you've just installed.
mysql = require("mysql");
// Create the connection.
// Data is default to new mysql installation and should be changed
according to your configuration.
var connection = mysql.createConnection({
user: "root",
password: "",
database: "books"
});
// Create the http server.
http.createServer(function (request, response) {
// Attach listener on end event.
request.on('end', function () {
// Query the database.
connection.query('SELECT * FROM authors;', function (error, rows,
fields) {
response.writeHead(200, {
'Content-Type': 'x-application/json'
});
// Send data as JSON string.
// Rows variable holds the result of the query.
response.end(JSON.stringify(rows));
});
});
// Listen on the 8080 port.
}).listen(8081);
===================================================
As you can see on last line this program will listen to port 8081.
I have WAMP server in which I have created a project and have an index.html
page in it.
>From index.html page I am hitting Node.js program above through $.get of
jQuery ajax.
But WAMP is running on port 81, so Chrome is not allowing me to access
Cross Origin resources.
What can I do to hit Node JS server mentioned above through the index.html
page hosted on WAMP server.
(FYI : WAMP is a PHP server)
Please let me know.
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.