const express = require('express'); const bodyParser = require('body-parser'); const requestIp = require('request-ip'); const cron = require('node-cron'); const moment = require('moment'); const crypto = require('crypto'); const axios = require('axios'); var cors = require('cors'); const app = express(); //const port = 443; const port = 8080; // Define a test URL that returns JSON app.use(bodyParser.json()); app.use(cors({ allowedHeaders: 'Content-Type, Cache-Control' })); app.use(bodyParser.urlencoded({ extended: true })); app.use((req, res, next) => { res.setHeader('Cache-Control', 'no-store'); next(); }); app.get('/api', (req, res) => { res.json({ message: 'testing', success: true, timestamp: new Date().toISOString() }); }); app.get('/api/testing', (req, res) => { res.json({ message: 'testing', data: 'hello world!' }); }); app.get('/api/data_json', (req, res) => { res.json({ message: 'data JSON', data: 'Data berhasil di ambil!' }); }); // Start the server app.listen(port, () => { console.log(`Server running at http://localhost:${port}/test`); });