Skip to content

Commit

Permalink
fixing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Levironexe committed Oct 17, 2024
1 parent 5918197 commit 5115925
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/api/backend.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ import multer from 'multer'; // Use multer for file uploads
import ProjectNameModel from './schema.mjs'; // Import your Mongoose model

const app = express(); // Initialize Express app
app.use(express.json()); // Parse JSON bodies

// Middleware setup
app.use(cors(corsOptions));

app.use(express.json()); // Parse JSON bodies

// Handle OPTIONS request (Preflight request)
app.options('*', cors(corsOptions)); // For all routes
const corsOptions = {
origin: 'https://blockscan-swin.vercel.app', // Your Vercel frontend URL
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization'],
credentials: true, // Optional: allow cookies or authentication
};
app.use(cors(corsOptions));
app.options('*', cors(corsOptions)); // For all routes

// MongoDB connection
const mongoUrl = "mongodb+srv://leviron:[email protected]/BlockScanDB?retryWrites=true&w=majority&appName=BlockScan";
mongoose
Expand Down

0 comments on commit 5115925

Please sign in to comment.