Server-Side Development Tutorials, Guides & Insights

Unlock 2+ expert-curated server-side tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your server-side skills on DeveloperBreeze.

Building Progressive Web Apps (PWAs) with Modern APIs

Tutorial August 05, 2024
json bash

In app.js, add a function to request notification permission:

document.getElementById('notify-btn').addEventListener('click', () => {
  Notification.requestPermission().then(permission => {
    if (permission === 'granted') {
      new Notification('Hello! Notifications are enabled.');
    }
  });
});

Building a Real-Time Chat Application with WebSockets in Node.js

Tutorial August 03, 2024
javascript css html

Create a file named server.js in your project directory and add the following:

const express = require('express');
const http = require('http');
const socketIo = require('socket.io');

const app = express();
const server = http.createServer(app);
const io = socketIo(server);

app.use(express.static('public'));

io.on('connection', (socket) => {
    console.log('A user connected');

    socket.on('chatMessage', (msg) => {
        io.emit('chatMessage', msg);
    });

    socket.on('disconnect', () => {
        console.log('User disconnected');
    });
});

const PORT = process.env.PORT || 3000;
server.listen(PORT, () => console.log(`Server running on port ${PORT}`));