14 |
15 |
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Fullstack Chat App
2 |
3 | ## 📌 Опис
4 | Повноцінний чат-додаток з WebSockets, реєстрацією та повідомленнями
5 |
6 | ## 🚀 Використання
7 | 1. Перейдіть у папку `backend` та встановіть залежності:
8 | ```sh
9 | npm install
10 | ```
11 | 2. Запустіть сервер:
12 | ```sh
13 | npm start
14 | ```
15 | 3. Відкрийте `frontend/index.html` у браузері.
16 |
17 | ## 🔧 Додаткові можливості
18 | - Розширення функціоналу API.
19 | - Додавання авторизації користувачів.
20 |
21 | Ліцензія: MIT License
22 |
--------------------------------------------------------------------------------
/backend/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const http = require('http');
3 | const socketIo = require('socket.io');
4 | const cors = require('cors');
5 |
6 | const app = express();
7 | const server = http.createServer(app);
8 | const io = socketIo(server, { cors: { origin: '*' } });
9 |
10 | app.use(cors());
11 | app.use(express.json());
12 |
13 | io.on('connection', (socket) => {
14 | console.log('Користувач підключився');
15 | socket.on('message', (data) => {
16 | io.emit('message', data);
17 | });
18 | socket.on('disconnect', () => console.log('Користувач відключився'));
19 | });
20 |
21 | server.listen(5000, () => console.log('Сервер чату запущено на порту 5000'));
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 adsstudio24
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------