//import http from "http"; agora vai utilizar o express entao nao precisa dessa linha
import app from "./src/app";
const PORT = 3000;
const rotas = {
"/": "cursos express api",
"/livros": "Entrei na rota livros",
};
//const server = http.createServer((req, res) => {
// res.writeHead(200, { "Content-Type": "text/plain" });
// res.end(rotas[req.url]);
//}); no serve agora nao precisa mais criar o servidor, porque o express ira fazer para a gente.
app.listen(PORT, () =>{
console.log(`Servidor escutando na porta ${PORT}`);
});
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting node server.js
file:///C:/Users/Admin/Desktop/Programa/agenda-api-main/server.js:2
import app from "./src/app.js";
^^^
SyntaxError: The requested module './src/app.js' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:191:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:106:12)
Node.js v18.20.5 [nodemon] app crashed - waiting for file changes before starting...
O que pode ser esse erro