Der folgende Inhalt der Datei application.js meldet, dass "home", das importiert wird, nicht definiert ist.Importieren der Indexdatei für das Verzeichnis, das nicht ordnungsgemäß funktioniert
import {home} from "./routes/index"
console.log(JSON.stringify(home, null, 4))
Der Gehalt an index.js sind wie folgt:
export * from "./home.js"
Der Gehalt an home.js sind wie folgt:
export const type = "GET"
export const route = "/"
export const middleware = [];
export const action = function(req, res) {
res.send("Testing custom routes");
}
Ein Bild von der Verzeichnisstruktur ist wie folgt :
Ihre Exporte werden nicht von 'home' vorangestellt. Versuchen Sie 'import {middleware} von './routes'' (kein Index). Das gleiche gilt für "type", "route" und "action" in Ihrem Beispiel. –