This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const fs = require("fs"); | |
const path = require("path"); | |
const app = express(); | |
const port = process.env.PORT || 3000; | |
const dataFilePath = path.join(__dirname, "data.json"); | |
// Função para ler os dados do arquivo JSON | |
const readData = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Notifier { | |
private subscribers: ((notification: Notification) => void)[] = []; | |
constructor(subscribers: ((notification: Notification) => void)[]) { | |
this.subscribers = subscribers; | |
} | |
public notify(notification: Notification) { | |
this.subscribers.forEach((subscriber) => subscriber(notification)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CODE EXAMPLE FROM YOUTUBE LIVE: Golang: Modelo de concorrencia goroutine + channels | |
// LINK: https://youtube.com/live/TRx3W4mLFf8 | |
// Lucas_Badico: Dev, mentor e apaixonado por Programacao | |
// SIGA ME EM TODAS AS REDES SOCIAIS | |
package main | |
import ( | |
"time" | |
"fmt" | |
"sync" |
OlderNewer