A common way people handle requests like this in the Node world is to use
the express <https://github.com/visionmedia/express> framework to handle
routing according to a certain URL/path scheme and parse query strings /
request bodies.
To handle a path
like
/core/health/clinicalAssessments/12345_678_9999.xml?startDate=2011-06-01&endDate=2012-12-01
you
would have something like:
var app = require('express')();
app.get('/core/health/clinicalAssessments/:filename', function(req,res)
{
var filename = req.params.filename; //this would be
"12345_678_9999.xml"
var startDate = req.query.startDate; //this would be "2011-06-01"
var endDate = req.query.endDate; //this would be "2012-12-01"
// This is where you'd do the meat of your processing - getting
records,
// hitting the database, rendering, etc. At some point down a line of
// async calls, you'd eventually come to a point where you're ready to
// send a response.
// You can create an HTML string using whatever technique you want.
// You can also set up a templating engine and use res.render()
res.send(200,"the operation is successful");
});
app.listen(8080);
For more information, see the Express API
documentation<http://expressjs.com/api.html>
.
On Tuesday, January 7, 2014 12:43:54 PM UTC-8, JPJen wrote:
>
> I have never programmed using the Node.js.
>
> I am going to enter a URL; for example, http(s)://localhost:8080/core/ping
> in the browser window and would like to have a Status 200 with a message
> saying that "the operation is successful" in return. How do I proceed in
> doing it?
>
> Thank you very much.
>
>
--
--
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.