Cleaning code for index.js
This commit is contained in:
8
utils/analyticsLogger.js
Normal file
8
utils/analyticsLogger.js
Normal file
@@ -0,0 +1,8 @@
|
||||
const PostHog = require('posthog-node');
|
||||
|
||||
const client_logger = new PostHog.PostHog(
|
||||
process.env.POSTHOG_API_KEY,
|
||||
{ host: 'https://us.i.posthog.com' }
|
||||
)
|
||||
|
||||
module.exports = { client_logger };
|
||||
15
utils/sessionUtils.js
Normal file
15
utils/sessionUtils.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// Utilities
|
||||
const getSessionId = function (req) {
|
||||
const session_id = req.cookies.session_id || req.query.session_id || req.body.session_id;
|
||||
return session_id;
|
||||
}
|
||||
const getUserId = function (req) {
|
||||
const user_sid = req.cookies.user_sid || req.query.user_sid || req.body.user_sid;
|
||||
return user_sid;
|
||||
}
|
||||
const getProfileId = function (req) {
|
||||
const profile_id = req.cookies.profile_id || req.query.profile_id || req.body.profile_id;
|
||||
return profile_id;
|
||||
}
|
||||
|
||||
module.exports = { getSessionId, getUserId, getProfileId };
|
||||
Reference in New Issue
Block a user