Skip to content

Instantly share code, notes, and snippets.

@itswadesh
Last active March 27, 2017 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itswadesh/c5b2fa45931b25013e03ef851f2dfaf3 to your computer and use it in GitHub Desktop.
Save itswadesh/c5b2fa45931b25013e03ef851f2dfaf3 to your computer and use it in GitHub Desktop.
// Dependencies
var express = require('express');
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
// MongoDB
mongoose.connect('mongodb://localhost/appointment');
// mongoose.connection.on('error', function(){});
// Express
var app = express();
app.use(express.static(__dirname + './../public'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
// Routes
app.use('/api', require('./api/appointment/'));
// Start server
var port = 8080
, ip = "127.0.0.1";
app.listen(port, ip, function() {
console.log('Express server listening on %d', port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment