diff --git a/.DS_Store b/.DS_Store index f61f1e4..0a8b6df 100644 Binary files a/.DS_Store and b/.DS_Store differ 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};