Express kutuphanesi icin @Akif9748 hocamın GitHub'ında bulunan bir Repo'dan "Route Handler" aldım.
[CODE title="Handler"]for (const type of fs.readdirSync("./routes"))
for (const file of fs.readdirSync("./routes/" + type))
console.log(file)
app[type](`/$*`, require(`./routes/$/$`))[/CODE]
Her seferinde "TypeError: App[type] is not a function" hatası alıyorum.
Nasıl duzeltebilirim? Neyi yanlış yapıyorum?
Ben /routes klasoru altına oluşturduğum dosyalar "GET" ve "POST" adına sahipti. Sonra aklıma geldi...
app.GET() değil app.get() olması lazım. Yani sorun buyuk harf olmasıymış. Cozdum sonunda!