Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DatabaseTest
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Magomed Khatujevitsj Bakhmadov
DatabaseTest
Commits
1b744c18
Commit
1b744c18
authored
6 years ago
by
Magomed Khatujevitsj Bakhmadov
Browse files
Options
Downloads
Patches
Plain Diff
Update server.js
parent
8afead41
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#22884
passed with warnings with stages
in 2 minutes and 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server.js
+20
-3
20 additions, 3 deletions
server.js
with
20 additions
and
3 deletions
server.js
+
20
−
3
View file @
1b744c18
...
...
@@ -9,9 +9,9 @@ const PersonDao = require("./dao/persondao.js");
var
pool
=
mysql
.
createPool
({
connectionLimit
:
2
,
host
:
"
mysql.stud.iie.ntnu.no
"
,
user
:
"
nilstesd
"
,
password
:
"
lqqWcMzq
"
,
database
:
"
nilstesd
"
,
user
:
"
magomedb
"
,
password
:
"
paYDbECG
"
,
database
:
"
magomedb
"
,
debug
:
false
});
...
...
@@ -41,4 +41,21 @@ app.post("/person", (req, res) => {
});
});
app
.
put
(
"
/person/:personId
"
,
(
req
,
res
)
=>
{
//Burde egentlig sjekke om det eksisterer, validere også oppdatere for å unngå feil
console
.
log
(
"
/person/:personId: fikk request fra klient
"
);
personDao
.
updateOne
(
req
.
params
.
personId
,
req
.
body
,
(
status
,
data
)
=>
{
res
.
status
(
status
);
res
.
json
(
data
);
});
});
app
.
delete
(
"
/person/:personId
"
,
(
req
,
res
)
=>
{
console
.
log
(
"
/person/:personId: fikk request fra klient
"
);
personDao
.
deleteOne
(
req
.
params
.
personId
,
(
status
,
data
)
=>
{
res
.
status
(
status
);
res
.
json
(
data
);
});
});
var
server
=
app
.
listen
(
8080
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment