minimal register&login working

This commit is contained in:
arnaucube
2019-06-13 20:26:05 +02:00
parent f7a5bbb91e
commit 0cd29328b4
17 changed files with 348 additions and 16 deletions

1
test/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

56
test/package-lock.json generated Normal file
View File

@@ -0,0 +1,56 @@
{
"name": "gogame-test",
"version": "0.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"axios": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
"integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
}
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
}
},
"is-buffer": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz",
"integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw=="
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"nan": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
},
"sleep": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/sleep/-/sleep-6.1.0.tgz",
"integrity": "sha512-Z1x4JjJxsru75Tqn8F4tnOFeEu3HjtITTsumYUiuz54sGKdISgLCek9AUlXlVVrkhltRFhNUsJDJE76SFHTDIQ==",
"requires": {
"nan": "^2.13.2"
}
}
}
}

23
test/package.json Normal file
View File

@@ -0,0 +1,23 @@
{
"name": "gogame-test",
"version": "0.0.1",
"description": "",
"main": "test.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/arnaucube/gogame.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/arnaucube/gogame/issues"
},
"homepage": "https://github.com/arnaucube/gogame#readme",
"dependencies": {
"axios": "^0.19.0",
"sleep": "^6.1.0"
}
}

31
test/test.js Normal file
View File

@@ -0,0 +1,31 @@
const axios = require('axios');
const sleep = require('sleep');
const url = 'http://127.0.0.1:5000';
let newUser = {
name: 'user00',
password: 'user00password',
email: 'user00@email.com'
};
axios.post(url + '/register', newUser)
.then(function (res) {
console.log(res.data);
})
.catch(function (error) {
console.log(error.response.data);
});
// sleep.sleep(3);
let user = {
email: 'user00@email.com',
password: 'user00password'
};
axios.post(url + '/login', user)
.then(function (res) {
console.log(res.data);
})
.catch(function (error) {
console.log(error.response.data);
});