Skip to content

Instantly share code, notes, and snippets.

@aug2uag
Created January 26, 2014 04:45
Show Gist options
  • Select an option

  • Save aug2uag/8628532 to your computer and use it in GitHub Desktop.

Select an option

Save aug2uag/8628532 to your computer and use it in GitHub Desktop.
Express Mongo instant
// configure API
var express = require('express')
, app = express();
var mongodb = require('mongodb');
var MongoClient = require('mongodb').MongoClient
, format = require('util').format;
MongoClient.connect('mongodb://127.0.0.1:27017/enterDbName', function(err, db) {
if (err) { throw err; }
app.use(express.bodyParser());
// default route does nothing
app.get('/', function(req, res) {
res.write('welcome to proj 0.0.1');
res.end();
});
app.listen(1230);
console.log('Express server now listening port 1230');
//});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment