• Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Precios
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

99
Vistas
I am trying to fetch information from phpmyadmin database, but in browser it's showing cannot get/employee and in command prompt there is no error
    const { json } = require('express/lib/response');
    const mysql=require ('mysql');
const express=require('express');
var app=express();
const bodyparser=require('body-parser');
app.use(bodyparser.json());

var mysqlConnection=mysql.createConnection({
    host:'localhost',
    user: 'root',
    password:'',
    database: 'employee_db'
});
mysqlConnection.connect((err)=>{
    if(!err)
    {
        console.log("DB connection is successfull");
    }
    else{
        console.log("DB connection failed "+JSON.stringify(err,undefined,2));
    }
});
app.listen(8000,()=>console.log('Express server is running on port number: 8000'));
app.get('/employess',(res,req)=>{
    mysqlConnection.query('SELECT * FROM EMPLOYEE',(err,rows,fields)=>{
        if(!err)
        {
            console.log(rows);
        }
        else{
            console.log(err);
        }
    })
});

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS E:\Development\crud-node> node index.js Express server is running on port number: 8000 DB connection is successful

9 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

there seems to be spelling mistake in end point. The one you specified in error detail and the one defined in the code are different

9 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.