Blue demon commited on
Commit
5f3f47a
·
verified ·
1 Parent(s): 359f2a2

Delete server.js

Browse files
Files changed (1) hide show
  1. server.js +0 -53
server.js DELETED
@@ -1,53 +0,0 @@
1
- const express = require('express');
2
- const bodyParser = require('body-parser');
3
- const axios = require('axios');
4
- const app = express();
5
- const PORT = 3000;
6
-
7
- app.use(bodyParser.json());
8
-
9
- // Replace these with your actual Telegram bot token and chat ID
10
- const TELEGRAM_BOT_TOKEN = '7848263680:AAHssiY_S00SLQDCI9D5SRfCe0iWquCKJSI';
11
- const TELEGRAM_CHAT_ID = '6573270131';
12
-
13
- // Function to send a Telegram message
14
- function sendTelegramMessage(message) {
15
- const url = `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`;
16
- axios.post(url, {
17
- chat_id: TELEGRAM_CHAT_ID,
18
- text: message,
19
- parse_mode: 'Markdown'
20
- })
21
- .then(response => {
22
- console.log('Message sent to Telegram:', response.data);
23
- })
24
- .catch(error => {
25
- console.error('Error sending message to Telegram:', error);
26
- });
27
- }
28
-
29
- // Registration endpoint
30
- app.post('/register', (req, res) => {
31
- const { username, email, password } = req.body;
32
-
33
- // Here, you would normally add code to save the user's info to a database
34
-
35
- // Send Telegram notification
36
- const message = `New User Registration:\nUsername: ${username}\nEmail: ${email}`;
37
- sendTelegramMessage(message);
38
-
39
- res.json({ message: 'Registration successful. Please wait for approval.' });
40
- });
41
-
42
- // Login endpoint
43
- app.post('/login', (req, res) => {
44
- const { username, password } = req.body;
45
-
46
- // Here, you would normally check the username and password with the database
47
-
48
- res.json({ message: 'Login successful!' });
49
- });
50
-
51
- app.listen(PORT, () => {
52
- console.log(`Server running on http://localhost:${PORT}`);
53
- });