Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DMWT_Season10_Group_2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Sven Holm
DMWT_Season10_Group_2
Commits
5479b687
Commit
5479b687
authored
1 year ago
by
Tim-Luca Taxis
Browse files
Options
Downloads
Patches
Plain Diff
added
parent
ff847c07
No related branches found
No related tags found
1 merge request
!4
added vercel integration
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dmwt_session10/src/pages/API/add-fruit.js
+0
-1
0 additions, 1 deletion
dmwt_session10/src/pages/API/add-fruit.js
dmwt_session10/src/pages/API/fruit-table.js
+15
-10
15 additions, 10 deletions
dmwt_session10/src/pages/API/fruit-table.js
with
15 additions
and
11 deletions
dmwt_session10/src/pages/API/add-fruit.js
+
0
−
1
View file @
5479b687
...
...
@@ -15,7 +15,6 @@ export default async function handler(request, response) {
`
;
const
{
rows
:
fruits
}
=
await
sql
`SELECT * FROM obst;`
;
return
response
.
status
(
200
).
json
(
fruits
);
}
catch
(
error
)
{
console
.
error
(
'
Error during request processing:
'
,
error
);
...
...
This diff is collapsed.
Click to expand it.
dmwt_session10/src/pages/API/fruit-table.js
+
15
−
10
View file @
5479b687
import
{
sql
}
from
'
@vercel/postgres
'
;
export
default
async
function
handler
(
request
,
response
)
{
if
(
request
.
method
===
'
POST
'
)
{
try
{
const
result
=
await
sql
`
const
result
=
await
sql
`
CREATE TABLE IF NOT EXISTS obst (
"Deutscher Name" varchar(50) NOT NULL,
"Lateinischer Name" varchar(50) NOT NULL,
Farbe varchar(50) NOT NULL,
Herkunft varchar(200) NOT NULL,
Kalorien int NOT NULL
);`
;
return
response
.
status
(
200
).
json
({
result
});
"Deutscher Name" varchar(50) NOT NULL,
"Lateinischer Name" varchar(50) NOT NULL,
Farbe varchar(50) NOT NULL,
Herkunft varchar(200) NOT NULL,
Kalorien int NOT NULL
);
`
;
return
response
.
status
(
200
).
json
({
result
});
}
catch
(
error
)
{
console
.
error
(
'
Error creating table:
'
,
error
);
return
response
.
status
(
500
).
json
({
error
:
error
.
message
});
console
.
error
(
'
Error creating table:
'
,
error
);
return
response
.
status
(
500
).
json
({
error
:
error
.
message
});
}
}
else
{
return
response
.
status
(
405
).
json
({
message
:
'
Method Not Allowed
'
});
}
}
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