Toggle navigation
Toggle navigation
This project
Loading...
Sign in
정승호
/
Hexa_for_you_renewal
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
정승호
2020-05-22 20:18:09 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e82997b06182367ebbaab92fed402b554e5524f9
e82997b0
1 parent
b3ad1822
MongoDb 암호 숨김
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
8 deletions
.gitignore
config/key.js
config/prod.js
index.js
package-lock.json
package.json
.gitignore
View file @
e82997b
node_modules
\ No newline at end of file
node_modules
dev.js
...
...
config/key.js
0 → 100644
View file @
e82997b
if
(
process
.
env
.
NODE_ENV
===
'production'
){
module
.
exports
=
require
(
'./prod'
)
}
else
{
module
.
exports
=
require
(
'./dev'
)
}
\ No newline at end of file
config/prod.js
0 → 100644
View file @
e82997b
module
.
exports
=
{
mongoURI
:
process
.
env
.
MONGO_URI
}
\ No newline at end of file
index.js
View file @
e82997b
...
...
@@ -6,19 +6,21 @@ const port = 5000
const
{
User
}
=
require
(
'./models/Users'
);
const
config
=
require
(
'./config/dev'
)
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
app
.
use
(
bodyParser
.
json
());
const
mongoose
=
require
(
'mongoose'
)
mongoose
.
connect
(
'mongodb+srv://platoon07:wony9795!!@2020oss-ysxss.mongodb.net/test?retryWrites=true&w=majority'
,{
mongoose
.
connect
(
config
.
mongoURI
,{
useNewUrlParser
:
true
,
useUnifiedTopology
:
true
,
useCreateIndex
:
true
,
useFindAndModify
:
false
}).
then
(()
=>
console
.
log
(
'MongoDb connected....'
))
.
catch
(
err
=>
console
.
log
(
'Error'
))
app
.
get
(
'/'
,
(
req
,
res
)
=>
res
.
send
(
'Hello world!!'
))
app
.
get
(
'/'
,
(
req
,
res
)
=>
res
.
send
(
'Hello world!!
오늘도 지식이 쌓였당!!
'
))
app
.
post
(
'/register'
,
(
req
,
res
)
=>
{
// 회원 가입시 필요한 정보들을 client에서 가져오면
...
...
@@ -34,7 +36,4 @@ app.post('/register', (req, res) => {
})
app
.
listen
(
port
,
()
=>
console
.
log
(
'example app listen on port ${port}!'
))
// mongodb+srv://platoon07:<password>@2020oss-ysxss.mongodb.net/test?retryWrites=true&w=majority
\ No newline at end of file
app
.
listen
(
port
,
()
=>
console
.
log
(
'example app listen on port %s!'
,
port
))
...
...
package-lock.json
View file @
e82997b
This diff is collapsed. Click to expand it.
package.json
View file @
e82997b
...
...
@@ -5,6 +5,7 @@
"main"
:
"index.js"
,
"scripts"
:
{
"start"
:
"node index.js"
,
"backend"
:
"nodemon index.js"
,
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"repository"
:
{
...
...
@@ -16,7 +17,9 @@
"dependencies"
:
{
"body-parser"
:
"^1.19.0"
,
"express"
:
"^4.17.1"
,
"mongoose"
:
"^5.9.15"
,
"mongoose"
:
"^5.9.15"
},
"devDependencies"
:
{
"nodemon"
:
"^2.0.4"
}
}
...
...
Please
register
or
login
to post a comment