📁 File Manager Pro
v10.0.3 | PHP: 8.2.31
Server: LiteSpeed
2026-06-30 16:09:00
📂
/ (Root)
/
home
/
orkouolp
/
node_js
/
orkobd.com
📍 /home/orkouolp/node_js/orkobd.com
🔄 Refresh
✏️
Editing: index.js
Writable
const express = require('express'), app = express(); const path = require('path'), PORT = process.env.PORT || 3100; const bodyParser = require('body-parser'), mysql = require('mysql'); const con = mysql.createConnection({ // host: 'localhost', user: 'root', password: 'Pass@123', database: 'testing' host: 'localhost', user: 'orkouolp_testing', password: 'P123@testing', database: 'orkouolp_testing' // host: 'localhost', user: 'lalkuftm_lalkella', password: 'P123@lalkella', database: 'lalkuftm_lalkella' // host: 'localhost', user: 'lalkuftm_orkobd', password: 'P123@orkobd', database: 'lalkuftm_orkobd' }); con.connect((err) => { if (err) throw err; console.log('Connected!'); }); // console.log(bodyParser); app.use(bodyParser.json()); // app.use(bodyParser.urlencoded({ extended: true })); // app.use(express.static(path.join(__dirname, 'realdeal', 'build'))); app.use(express.static(path.join(__dirname, 'public'))); app.get('/express_backend', (req, res) => { res.send({ express: 'YOUR EXPRESS BACKEND IS CONNECTED TO REACT' }); }); app.get('/api', async (req, res) => res.send({ message: 'Hello' })); app.post('/api/subscriptions', async (req, res) => { console.log('req.body:', req.body); console.log(req.body.name, req.body.email); return con.query("SELECT COUNT(*) AS count FROM subscriptions WHERE email=?", req.body.email, (err, rows) => { if(err) throw err; console.log(rows, rows[0].count); if (rows[0].count > 0) res.send({ message: 'Duplicate' }); // res.redirect('/duplicate'); else { const subscription = { name: req.body.name, email: req.body.email }; return con.query('INSERT INTO subscriptions SET ?', subscription, (err, set) => { if(err) throw err; console.log('Last insert ID:', set.insertId); res.send({ message: 'Success' }); // res.redirect('/success'); }); } }); }); app.get('/comingsoon', express.static(path.join(__dirname, 'comingsoon')), async (req, res) => { res.sendFile(path.join(__dirname, 'comingsoon', 'index.html')); }); app.get('/comingsoon/*', express.static(path.join(__dirname, 'comingsoon')), async (req, res) => { let url_path = req.url.substr(req.url.indexOf('comingsoon')+10); if(url_path.lastIndexOf('?') > 0) { // console.log('\n********', url_path.substr(url_path.lastIndexOf('?')+1), url_path.substring(0, url_path.lastIndexOf('?')), '********'); url_path = url_path.substring(0, url_path.lastIndexOf('?')); } const ext = req.url.substr(req.url.lastIndexOf('.')+1); console.log(req.url, url_path, ext); if (req.url.split('.').length < 2) res.sendFile(path.join(__dirname, 'comingsoon', 'index.html')); else //if (ext !== 'map') res.sendFile(path.join(__dirname, 'comingsoon', url_path)); }); app.get('/lalkella', express.static(path.join(__dirname, 'lalkella', 'build')), async (req, res) => { console.log(req.url); res.sendFile(path.join(__dirname, 'lalkella', 'build', 'index.html')); }); app.get('/lalkella/*', express.static(path.join(__dirname, 'lalkella', 'build')), async (req, res) => { let url_path = req.url.substr(req.url.indexOf('lalkella')+8); if(url_path.lastIndexOf('?') > 0) { console.log('\n********', url_path.substr(url_path.lastIndexOf('?')+1), url_path.substring(0, url_path.lastIndexOf('?')), '********'); url_path = url_path.substring(0, url_path.lastIndexOf('?')); } const ext = req.url.substr(req.url.lastIndexOf('.')+1); console.log(req.url, url_path, ext); // res.sendFile(path.join(__dirname, '/lalkella/', 'build/', 'index.html')); if (req.url.split('.').length < 2) res.sendFile(path.join(__dirname, 'lalkella', 'build', 'index.html')); else //if (ext !== 'map') res.sendFile(path.join(__dirname, 'lalkella', 'build', url_path)); }); app.use(express.static(path.join(__dirname, 'orkobd', 'build'))); app.get('*', async (req, res) => { res.sendFile(path.join(__dirname, 'orkobd', 'build', 'index.html')); }); app.listen(PORT, () => console.log(`Server is running on port ${PORT}`));
💾 Save Changes
❌ Cancel