var constants = require(’./constants/event’); var utils = require(‘util’); var path = require(‘path’) var fs = require(‘fs’) var querystring = require(‘querystring’); var formidable = require(‘formidable’) var bodyParser = require(‘body-parser’); var express = require(‘express’)(); var app = require(‘http’).createServer(express); var io = require(’socket.io‘).listen(app); var url = require(‘url’); var User = require(’./model/user’); var _ = require(‘underscore’); var mongoose = require(‘mongoose’); var port = 3030;
mongoose.connect(“mongodb://localhost/imchat”);
express.use(bodyParser.json()) express.use(bodyParser.urlencoded({extended:true})) express.use(require(‘express’).static(path.join(__dirname,“upload”))) 这个是我的项目结构,图片都在upload文件夹里面