-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask3.js
More file actions
45 lines (37 loc) · 1.14 KB
/
task3.js
File metadata and controls
45 lines (37 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const express = require("express");
const PORT = process.env.PORT || 3002;
// const db = require("./knex");
const app = express();
/*
Task 3
1. Take a look at the database migrations under the migrations folder to see the table structure that exists.
2. You will be provided with a database URL that you can connect to which has the tables setup along with the data.
3. Based on that write an API that returns the following response after fetching the data from the database
4. Feel free to refer to any documentation or use any library that might help with achieving the result
[
{
"id": 1,
"name": "The Witcher",
"author": "Andrzej Sapkowski",
"created_at": "22-07-2024",
"updated_at": "22-07-2024"
},
{
"id": 2,
"name": "The Lord of the Rings",
"author": "John Ronald Reuel Tolkien",
"created_at": "22-07-2024",
"updated_at": "22-07-2024"
},
{
"id": 3,
"name": "Matilda",
"author": "Roald Dahl",
"created_at": "22-07-2024",
"updated_at": "22-07-2024"
}
]
*/
app.listen(PORT, () => {
console.log(`Listening on port: ${PORT}`);
});