const express = require('express');
const mysql = require('mysql');
const session = require('express-session');
const path = require('path');
const bodyParser = require('body-parser');
const db = mysql.createConnection({
host: "localholst",
user: "root",
password: "password",
database: "nairobi"
});
db.connect((err) =>{
if (err) throw err;
console.log('database connected');
})
const app = express();
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use(express.static('public'));
app.get('/', (req, res) =>{
res.sendFile(path.join(__dirname + '/index.html'));
});
app.post('/auth', (req, res) =>{
const username = req.body.username;
})
app.listen(3000, () =>{
console.log('Server started on port 3000');
});
ask by john translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…