Created
January 26, 2014 04:45
-
-
Save aug2uag/8628532 to your computer and use it in GitHub Desktop.
Express Mongo instant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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