-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.js
More file actions
46 lines (45 loc) · 1.18 KB
/
api.js
File metadata and controls
46 lines (45 loc) · 1.18 KB
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
36
37
38
39
40
41
42
43
44
45
46
'use strict';
var bcrypt = require('bcrypt')
, db = require('mongojs')('GameServer', ['users', 'worlds', 'assets']);
module.exports = {
//data should contain a user and pass property and nothing else
createAccount : function(sock, sess, data) {
//10 is the size of the randomly generated salt
bcrypt.hash(data.pass, 10, function(err, hash) {
if(err) {
console.err(err);
return;
}
var newUser = {
'userName': data.user,
'pass': hash,
};
db.collection('users').save(newUser);
});
},
//data should contain a user and pass property and nothing else
login : function(sock, sess, data) {
},
logout : function(sock, sess, data) {
},
addAsset : function(sock, sess, data) {
},
removeAsset : function(sock, sess, data) {
},
joinWorld : function(sock, sess, data) {
},
createWorld : function(sock, sess, data) {
},
deleteWorld : function(sock, sess, data) {
},
leaveWorld : function(sock, sess, data) {
},
addItem : function(sock, sess, data) {
},
updateItem : function(sock, sess, data) {
},
deleteItem : function(sock, sess, data) {
},
giveItem : function(sock, sess, data) {
}
};