Skip to content

Instantly share code, notes, and snippets.

View gensart-x's full-sized avatar
😇
wherever the wind takes me.

gensart.yn gensart-x

😇
wherever the wind takes me.
View GitHub Profile
@gensart-x
gensart-x / sw.js
Created October 11, 2024 02:45
JS Service Worker for Push Notification
// Show notification if some data pushed to the service worker
self.addEventListener('push', event => {
// Get the data from the push message
const notification = event.data.json();
// Show the notification
event.waitUntil(self.registration.showNotification(notification.title, {
body: notification.body,
icon: 'icon.png',
data: {
@gensart-x
gensart-x / main.ts
Created June 7, 2024 09:04
Session setup, filesystem-based, Express Session for Node.js
// Session Setup
import sessionFileStore from 'session-file-store';
import expressSession from 'express-session';
declare module 'express-session' {
interface SessionData {
[key: string]: any
}
}
const fileStore = sessionFileStore(expressSession)
app.use(expressSession({