Skip to content
Snippets Groups Projects
Commit 1d9cee64 authored by Joonas Seppä's avatar Joonas Seppä
Browse files

Modifying response to GET

parent 28ae4660
No related branches found
No related tags found
No related merge requests found
Pipeline #61495 passed
...@@ -13,9 +13,15 @@ addMessage("This is my first message!") ...@@ -13,9 +13,15 @@ addMessage("This is my first message!")
async function addMessage(messageContent){ async function addMessage(messageContent){
await Message.create({content: "This is my first message!"}) await Message.create({message: "This is my first message!"})
messages = await Message.find() messages = await Message.find()
console.log(messages) console.log(messages);
(async () => {
await app.get("/", (req, res) => {
res.send(messages)
})
})()
await mongoose.disconnect() await mongoose.disconnect()
...@@ -24,10 +30,5 @@ async function addMessage(messageContent){ ...@@ -24,10 +30,5 @@ async function addMessage(messageContent){
app.get("/", (req, res) => {
res.send(messages)
})
const port = process.env.PORT || 3000 const port = process.env.PORT || 3000
app.listen(port) app.listen(port)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment