Skip to content

Commit 8945b54

Browse files
author
xiaolongXL
committed
登陆
1 parent 3685398 commit 8945b54

437 files changed

Lines changed: 95296 additions & 21 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

doc/demo/day1/shoppingCar/app.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ var logger = require('morgan');
55
var cookieParser = require('cookie-parser');
66
var bodyParser = require('body-parser');
77
var session = require('express-session');
8-
9-
var routes = require('./routes/index');
10-
var users = require('./routes/users');
11-
128
var register = require('./routes/register');
139
var login = require('./routes/login');
14-
var app = express();
10+
var mongoose = require('mongoose');
11+
mongoose.connect('mongodb://localhost:7000/mytest');
12+
var db = mongoose.connection;
1513

16-
// view engine setup
17-
app.set('views', path.join(__dirname, 'views'));
18-
app.set('view engine', 'jade');
14+
db.on('error', console.error.bind(console, 'connection error:'));
15+
db.once('open', function callback () {
16+
console.log('yes');
17+
});
18+
19+
var app = express();
1920

2021
// uncomment after placing your favicon in /public
2122
//app.use(favicon(__dirname + '/public/favicon.ico'));
@@ -29,8 +30,6 @@ app.use(session({
2930
}));
3031
app.use(express.static(path.join(__dirname, 'public')));
3132

32-
//app.use('/', routes);
33-
app.use('/users', users);
3433
app.use('/register', register);
3534
app.use('/login', login);
3635

24 KB
Binary file not shown.
88 Bytes
Binary file not shown.
64 MB
Binary file not shown.
16 MB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6673
64 MB
Binary file not shown.
16 MB
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var mongoose = require('mongoose');
2+
var kittySchema = mongoose.Schema({
3+
name: String,
4+
password:String
5+
});
6+
var userObj = mongoose.model('user', kittySchema);
7+
8+
module.exports = {
9+
userObj:userObj
10+
};

doc/demo/day1/shoppingCar/node_modules/mongoose/.npmignore

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)