// create express app
const express = require('express');
const cors = require('cors');
const fileUpload = require('express-fileupload');
const dotenv = require('dotenv');
const path = require('path');
const app = express();

dotenv.config();

app.use(express.static(path.join(__dirname, 'assets')));

app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(fileUpload());

app.get('/', (req, res) => {
    console.log("buka halaman utama");
    res.sendFile(__dirname + '/ui/index.html');

})

app.use('/before-login', require('./routes/before_login_route'));
app.use('/admin', require('./routes/admin_route'));




const port = process.env.PORT || 3002;

app.listen(port, () => {
    console.log(`Server running on port ${port}`);
})
