Node JS Content Type

I am trying to set the content-type to application/json in my Node js app.  I see examples of setting the content-type in the http.createServer routine, I'm using express so that syntax makes no sense to me!  But I believe I can set the content type in my mysql query routine which would make more sense  since I have multiple queries happening, both mysql and oracle.

If I do need to set up the content type in the server build, here's how I'm setting up the server:

var express = require('express');
var app = express();
var server = require('http').Server(app);
var io = require('socket.io')(server)

Thanks for any assistance. Node is driving me crazy...
kevbob650Asked:
Who is Participating?
 
RobOwner (Aidellio)Commented:
Hopefully this helps but I went straight to using Sails sailsjs.org as it takes care of all that stuff for you.  It's built on the MVC principles so integrating with any database is independent from the database itself.  Have a read and let me know if it suits your application.
0
 
kevbob650Author Commented:
I appreciate you looking into this. Sails looks very interesting, I will definitely explore. Thanks!
0
 
RobOwner (Aidellio)Commented:
No problem.  Glad it took your interest.  Certainly made life easy for me.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.