-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcat_server.js
More file actions
35 lines (29 loc) · 881 Bytes
/
Copy pathcat_server.js
File metadata and controls
35 lines (29 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
// Connecting to mongodb using mongoose
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/cats');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extend: true
}));
// requiring a path for cats
var cats = require('./routes/cat.js')(app);
// app.get('/', function(req, res){
// // res.send('Hello World!');
// res.json({hello: 'hi'});
// });
var server = app.listen(3000, function() {
console.log('Server running at http://127.0.0.1:3000/');
});
// var http = require('http');
//
// http.createServer(function(req, res){
// res.writeHead(200, {
// 'Content-Type': 'text/plain'
// });
// res.end('Hello World\n');
// }).listen(3000, '127.0.0.1');
//
// console.log('Server running at http://127.0.0.1:3000/');