-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.js
More file actions
56 lines (53 loc) · 1.42 KB
/
main.js
File metadata and controls
56 lines (53 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import express from 'express';
import chalk from 'chalk';
import path from 'path';
import { fileURLToPath } from 'url';
import {
getCities,
getPrayerTimes,
getPrayerTimesByMonth,
searchCities,
getHijriDate,
getTodayHijriDate,
getSurahList,
getSurahByNumber,
getAyahByNumber,
getAyahBySurahAndAyah,
getAyahBySurahAndAyahWithLength,
getAyahBySurahAndRange,
getRandomAyah,
getAyahByJuz,
getRandomSurah,
getAllHusna,
getHusnaByNumber,
getRandomHusna,
getAyahByTheme,
getAllThemes
} from 'cloudku-murotal';
const app = express();
const PORT = process.env.PORT || 5500;
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use('/', express.static(path.join(__dirname, 'app')));
app.get('/api/murotal/kota', async (req, res) => {
try {
const cities = await getCities();
res.json({
status: 'success',
creator: 'AlfiDev',
result: cities
});
} catch (error) {
res.status(500).json({
status: 'error',
creator: 'AlfiDev',
message: 'Failed to fetch cities'
});
}
});
//==================( Kalau Mau Nambah Fitur Tambahin sendiri yah error juga benerin sendiri)===================//
app.listen(PORT, () => {
console.log(chalk.cyan(`Server running on port ${PORT}`));
});