So we go to NodeJS
There’s this japanese dude online that once said
“Any coding course you take
is just someone that knows how to read the docs summarizing it for you”.
That stuck with me just like the investor who yelled at my startup project “EVERYTHING SUCKS UNTIL YOU GET A CHECK FROM AN INVESTOR”.
These Japanese men tend to have almost a miyagi thing about them don’t they?
Anyways I started watching nodeJS lessons that I bought for about 500 dollars 2 years ago.
I watch it like an asshole thinking I should just be reading the docs, it would take less time.
But I ramble on.
I send some GraphQL vs REST articles to my kindle so I can read some before the antidepressant kicks in and makes me sleep.
Anyways I tried to make it work using WSL with ubuntu distro for windows, but it seems that it doesn’t update the node server when I save my files on vscode.
So I just installed yarn on windows and started running on it, instead of yarn inside the linux machine.
What got me interested in this course is because I never really deployed any backend services on the cloud.
So if this course teaches me at least that, I’m good.
But god damn I wanted to make the gym api with graphql using elixir.
Alright I’m going to bed, I’m trying to wake up early everyday.
Anyways here’s the final code for today. We just played a bit.
const express = require('express')
const app = express()
app.use(express.json())
app.get("/courses", (request, response) => {
const query = request.query
console.log(`query`, query)
return response.json(['Curso 1','Curso 3','Curso 2',])
})
app.post("/courses", (request, response) => {
const body = request.body
console.log(`body`, body)
return response.json(['Curso 1','Curso 3','Curso 2', 'Curso 4'])
})
app.put("/courses/:id", (request, response) => {
const params = request.params
console.log(`params`, params)
return response.json(['Curso 6','Curso 3','Curso 2', 'Curso 4'])
})
app.patch("/courses/:id", (_request, response) => {
return response.json(['Curso 6','Curso 7','Curso 2', 'Curso 4'])
})
app.delete("/courses/:id", (_request, response) => {
return response.json(['Curso 6','Curso 3', 'Curso 4'])
})
app.listen(3333)