Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const apiCallLogger2 = (request: any, response: any, next: (err?: any) => any): any => {
- console.log("pocetak");
- const now = new Date();
- const hours = now.getHours();
- const minutes = now.getMinutes();
- if (
- hours >= 8 && hours <= 13 &&
- (hours < 13 || (hours === 13 && minutes <= 30))
- ) {
- console.log({hours, minutes});
- const logFilePath = path.join(__dirname, 'chatlog.txt');
- let logCount = 0;
- try {
- logCount = parseInt(fs.readFileSync(logFilePath, 'utf8') || '0');
- } catch (err) {
- console.error(err);
- }
- logCount++;
- fs.writeFileSync(logFilePath, logCount.toString(), 'utf8');
- }
- next();
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement