no deprecation on node16?
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "labwise-server",
|
"name": "labwise-server",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"type": "commonjs",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tsx watch src/index.ts",
|
"dev": "tsx watch src/index.ts",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { hash as argon2Hash, verify as argon2Verify } from '@node-rs/argon2';
|
|||||||
import { kyselyAdapter } from '@better-auth/kysely-adapter';
|
import { kyselyAdapter } from '@better-auth/kysely-adapter';
|
||||||
import { Kysely, PostgresDialect } from 'kysely';
|
import { Kysely, PostgresDialect } from 'kysely';
|
||||||
import { Pool } from 'pg';
|
import { Pool } from 'pg';
|
||||||
import { sendEmail, verificationEmailHtml, resetPasswordEmailHtml } from './email';
|
import { sendEmail, verificationEmailHtml, resetPasswordEmailHtml } from './email.js';
|
||||||
|
|
||||||
const db = new Kysely({
|
const db = new Kysely({
|
||||||
dialect: new PostgresDialect({
|
dialect: new PostgresDialect({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import FormData from 'form-data';
|
import FormData from 'form-data';
|
||||||
import Mailgun from 'mailgun.js';
|
import Mailgun from 'mailgun.js';
|
||||||
|
|
||||||
const mailgun = new Mailgun(FormData);
|
const mailgun = new (Mailgun as any)(FormData);
|
||||||
const mg = mailgun.client({
|
const mg = mailgun.client({
|
||||||
username: 'api',
|
username: 'api',
|
||||||
key: process.env.MAILGUN_API_KEY || '',
|
key: process.env.MAILGUN_API_KEY || '',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Request, Response, NextFunction } from 'express';
|
import { Request, Response, NextFunction } from 'express';
|
||||||
import { auth } from './auth';
|
import { auth } from './auth.js';
|
||||||
import { fromNodeHeaders } from 'better-auth/node';
|
import { fromNodeHeaders } from 'better-auth/node';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import { pool } from './pool';
|
import { pool } from './pool.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
async function migrate() {
|
async function migrate() {
|
||||||
const sql = fs.readFileSync(path.join(__dirname, 'schema.sql'), 'utf-8');
|
const sql = fs.readFileSync(path.join(__dirname, 'schema.sql'), 'utf-8');
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ import 'dotenv/config';
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
import { toNodeHandler } from 'better-auth/node';
|
import { toNodeHandler } from 'better-auth/node';
|
||||||
import { auth } from './auth/auth';
|
import { auth } from './auth/auth.js';
|
||||||
import { authRateLimiter, apiRateLimiter } from './auth/rateLimiter';
|
import { authRateLimiter, apiRateLimiter } from './auth/rateLimiter.js';
|
||||||
import chemicalsRouter from './routes/chemicals';
|
import chemicalsRouter from './routes/chemicals.js';
|
||||||
import protocolsRouter from './routes/protocols';
|
import protocolsRouter from './routes/protocols.js';
|
||||||
import profileRouter from './routes/profile';
|
import profileRouter from './routes/profile.js';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const PORT = process.env.PORT || 3001;
|
const PORT = process.env.PORT || 3001;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
import { pool } from '../db/pool';
|
import { pool } from '../db/pool.js';
|
||||||
import { requireAuth } from '../auth/middleware';
|
import { requireAuth } from '../auth/middleware.js';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
router.use(requireAuth);
|
router.use(requireAuth);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
import { requireAuth } from '../auth/middleware';
|
import { requireAuth } from '../auth/middleware.js';
|
||||||
import { pool } from '../db/pool';
|
import { pool } from '../db/pool.js';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
import { pool } from '../db/pool';
|
import { pool } from '../db/pool.js';
|
||||||
import { requireAuth } from '../auth/middleware';
|
import { requireAuth } from '../auth/middleware.js';
|
||||||
import multer from 'multer';
|
import multer from 'multer';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
router.use(requireAuth);
|
router.use(requireAuth);
|
||||||
|
|||||||
Reference in New Issue
Block a user