From 1f85ebc3d9eb1f17c3853ff4b3194f8642d6e586 Mon Sep 17 00:00:00 2001 From: Strife Date: Sun, 11 May 2025 15:14:03 +0500 Subject: [PATCH] change to import/export from required/export --- .DS_Store | Bin 6148 -> 6148 bytes db.js | 4 ++-- index.js | 12 ++++++------ package.json | 1 + routes/auth/auth.js | 4 ++-- routes/auth/checkSession.js | 4 ++-- routes/test/ping.js | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.DS_Store b/.DS_Store index f61f1e444e20eaa84a8973c1d3ec91f6573a9a89..0a8b6df4c705d35696ab8f4bbff618b0596e6b5b 100644 GIT binary patch delta 179 zcmZoMXfc@J&&atkU^gQp=VTrxc~(aT1_r&!223g*j6Xrl|6l-QF)#=+q%ssUm=rJTSQ z8MCejvko!Yg6*0&nT6SijR7P$Z?X-uIx9$z-sB8sRqk#O3u6D~h0MAvo7p-3@&f== CKP^uH delta 116 zcmZoMXfc@J&&aVcU^gQp$7CKRdDb-y3=9({8!)M`F}MJkA(Q7YX|XZ>0E?bsGG=vT zU|?jJ%))HTx(>{8V>V)AlmRpAnAKUkz^qlws@y;=j12$5VDm#}HI|7Do}1Y@{_+C= D32YuX diff --git a/db.js b/db.js index 7710f17..d6f7d84 100755 --- a/db.js +++ b/db.js @@ -1,4 +1,4 @@ -const knex = require('knex'); +import knex from 'knex'; const initializeDb = () => { const dbConfig = { @@ -19,4 +19,4 @@ const initializeDb = () => { const db = initializeDb(); -module.exports = db; +export {db}; diff --git a/index.js b/index.js index 256a479..743b3e3 100755 --- a/index.js +++ b/index.js @@ -1,10 +1,10 @@ -const express = require('express'); -const cors = require("cors"); -const bodyParser = require('body-parser'); +import express from 'express'; +import cors from "cors"; +import bodyParser from 'body-parser'; -const auth = require("./routes/auth/auth"); -const checkSession = require("./routes/auth/checkSession"); -const ping = require("./routes/test/ping"); +import {auth} from "./routes/auth/auth.js"; +import {checkSession} from "./routes/auth/checkSession.js" +import {ping} from "./routes/test/ping.js"; const authIgnorePaths = ['/ping'] diff --git a/package.json b/package.json index 55d51c4..fc8688d 100755 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "projectName", + "type": "module", "version": "1.0.0", "description": "", "main": "index.js", diff --git a/routes/auth/auth.js b/routes/auth/auth.js index 256eb55..ddce98f 100644 --- a/routes/auth/auth.js +++ b/routes/auth/auth.js @@ -1,4 +1,4 @@ -const db = require('../../db'); +import {db} from '../../db.js'; const auth = async (body) => { try { @@ -28,4 +28,4 @@ const auth = async (body) => { } } -module.exports = auth; +export {auth}; diff --git a/routes/auth/checkSession.js b/routes/auth/checkSession.js index aebf162..b515696 100644 --- a/routes/auth/checkSession.js +++ b/routes/auth/checkSession.js @@ -1,4 +1,4 @@ -const db = require('../../db'); +import {db} from '../../db.js'; const checkSession = async (token) => { try { @@ -13,4 +13,4 @@ const checkSession = async (token) => { } } -module.exports = checkSession; +export {checkSession}; diff --git a/routes/test/ping.js b/routes/test/ping.js index be1dd2d..4b3a264 100644 --- a/routes/test/ping.js +++ b/routes/test/ping.js @@ -10,4 +10,4 @@ const ping = async (data) => { } } -module.exports = ping; +export {ping};