completed exercise 3.1
This commit is contained in:
parent
68aa0e9905
commit
0bd43956c9
604 changed files with 67855 additions and 0 deletions
35
parts/3/phonebookBackend/index.js
Normal file
35
parts/3/phonebookBackend/index.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
const express = require("express");
|
||||
const app = express();
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
const PORT = 3001;
|
||||
|
||||
app.get("/api/persons", (request, response) => {
|
||||
response.json([
|
||||
{
|
||||
id: "1",
|
||||
name: "Arto Hellas",
|
||||
number: "040-123456",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
name: "Ada Lovelace",
|
||||
number: "39-44-5323523",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
name: "Dan Abramov",
|
||||
number: "12-43-234345",
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
name: "Mary Poppendieck",
|
||||
number: "39-23-6423122",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server running on port ${PORT}`);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue