HTML页面未显示

时间:2014-08-04 09:33:14

标签: javascript html node.js mongodb loading

当我从cmd运行时,它显示已连接到MongoDB,但是当我在localhost中运行时,它显示无法获取。我不知道为什么。

    var express = require('express'),
    filter = express(),
    server = require('http').createServer(filter),
    io = require('socket.io').listen(server),
    mongoose = require('mongoose');

    server.listen(7550, '127.0.0.1');
    console.log('Server running at http://127.0.0.1:7550/');

    mongoose.connect('mongodb://localhost/filter_CheckBoxSchema', function(err){
    if(err){
        console.log('What happened!!!');
    } else{
        console.log('Connected to mongodb!');
    }
});

var filter_CheckBoxSchema = mongoose.Schema({
    category : { name: String, type: Boolean, default: false },
    created: {type: Date, default: Date.now}
});

var Filter = mongoose.model('Filter', filter_CheckBoxSchema);

filter.post('example.html', function(req, res){
    new Filter({
        name: req.body.name,
        type: req.body.gender,

    }).save(function(err, doc){
        if(err) res.send('Successfully not inserted...');
        else
        res.send('Successfully inserted!!!');
    });
});

请帮助 提前谢谢。

0 个答案:

没有答案