Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-CloudComputing
/
D_Team_Khuloud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Hong
2020-06-08 02:36:40 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8098cef012a0d5580c76810d39c2952e67b0f17b
8098cef0
1 parent
080ee673
회원가입수정
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
backend/routes/userlogin/register.js
backend/routes/userlogin/register.js
View file @
8098cef
...
...
@@ -4,6 +4,7 @@ var async = require('async');
const
AWS
=
require
(
"aws-sdk"
);
AWS
.
config
.
loadFromPath
(
__dirname
+
"/../modules/awsconfig.json"
);
var
cryptoM
=
require
(
'./../../routes/modules/cryptoM.js'
);
const
moment
=
require
(
"moment"
);
const
BUCKET_NAME
=
"hong-s3-cloud"
;
const
s3
=
new
AWS
.
S3
();
...
...
@@ -34,7 +35,7 @@ router.post('/', function(req, res, next) {
connection
.
query
(
sql
,
values
,
function
(
err
)
{
if
(
err
)
{
console
.
log
(
"inserting user failed"
);
throw
err
;
res
.
status
(
400
).
send
({
err
:
err
})
;
}
else
{
let
params
=
{
Bucket
:
BUCKET_NAME
,
...
...
@@ -45,6 +46,7 @@ router.post('/', function(req, res, next) {
s3
.
putObject
(
params
,
function
(
err
,
data
)
{
if
(
err
)
{
console
.
log
(
's3 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
let
params2
=
{
Bucket
:
BUCKET_NAME
,
...
...
@@ -55,6 +57,7 @@ router.post('/', function(req, res, next) {
s3
.
putObject
(
params2
,
function
(
err
,
data
)
{
if
(
err
)
{
console
.
log
(
's3 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
let
params3
=
{
Bucket
:
BUCKET_NAME
,
...
...
@@ -65,8 +68,27 @@ router.post('/', function(req, res, next) {
s3
.
putObject
(
params3
,
function
(
err
,
data
)
{
if
(
err
)
{
console
.
log
(
's3 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
res
.
status
(
200
).
send
(
'saved'
);
let
date
=
moment
().
format
();
let
root
=
'/'
;
let
sql
=
"INSERT INTO folders (folder_name,location,user_id,created) values (?,?,?,?);"
;
connection
.
query
(
sql
,
[
'share'
,
root
,
user_id
,
date
],
function
(
err
,
result
,
field
)
{
if
(
err
)
{
console
.
log
(
'insert1 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
let
sql
=
"INSERT INTO folders (folder_name,location,user_id,created) values (?,?,?,?);"
;
connection
.
query
(
sql
,
[
'trashcan'
,
root
,
user_id
,
date
],
function
(
err
,
result
,
field
)
{
if
(
err
)
{
console
.
log
(
'insert2 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
res
.
status
(
200
).
send
(
'saved'
);
}
});
}
});
}
});
}
...
...
Please
register
or
login
to post a comment