const express = require('express'); const { translate } = require('./translator'); const app = express(); app.set('view engine', 'ejs'); app.use(express.json()); app.use(express.urlencoded({ extended: false })); app.use(express.static('public')); app.get('/', (req, res) => { res.render('index'); }) app.post('/', (req, res) => { translate(req.body.query, req.body.to); console.log(x); // error: x is not defined }) const PORT = process.env.PORT || 3000; app.listen(PORT, () => console.log(`Server is running on port ${PORT}...`));