You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constexpress=require('express');constapp=express();constserver=app.listen(3000,()=>{console.log('Start Server : localhost:3000');});app.set('views',__dirname+'/views');app.set('view engine','ejs');app.engine('html',require('ejs').renderFile);app.get('/',function(req,res){res.render('index.html');});app.get('/about',function(req,res){res.render('about.html');});
db μ°λ μ€μ΅
constexpress=require('express');constapp=express();constserver=app.listen(3000,()=>{console.log('Start Server : localhost:3000');});app.set('views',__dirname+'/views');app.set('view engine','ejs');app.engine('html',require('ejs').renderFile);app.get('/',function(req,res){res.render('index.html');});app.get('/about',function(req,res){res.render('about.html');});varmysql=require('mysql');varpool=mysql.createPool({host: '',user: '',port: '',password: '',database: '',});app.get('/db',function(req,res){pool.getConnection(function(err,connection){if(err)throwerr;// not connected!// Use the connectionconnection.query('SELECT * from Board',function(error,results,fields){res.send(JSON.stringify(results));console.log('results',results);// When done with the connection, release it.connection.release();// Handle error after the release.if(error)throwerror;// Don't use the connection here, it has been returned to the pool.});});});