mirror of
https://github.com/okiba-org/backend.git
synced 2025-07-02 04:48:22 +00:00
feat: add cors middleware
This commit is contained in:
@ -4,6 +4,7 @@ import BinRouter from "./routes/bin";
|
||||
import { Client, Pool } from "pg";
|
||||
import { createDataDir, errorHandler, logError, logSuccess } from "./utils";
|
||||
import { tableExists, populateDB } from "./db";
|
||||
import cors from "cors";
|
||||
|
||||
const main = async () => {
|
||||
dotenv.config();
|
||||
@ -33,8 +34,12 @@ const main = async () => {
|
||||
const app: Express = express();
|
||||
const port = process.env.PORT;
|
||||
|
||||
// FIX: other bodies panic
|
||||
app.use(express.text());
|
||||
|
||||
// check more on this later
|
||||
app.use(cors());
|
||||
|
||||
app.get("/", (req: Request, res: Response) => {
|
||||
res.send("Hello, World!");
|
||||
});
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { Router, Request, Response, NextFunction } from "express";
|
||||
import { Pool, QueryResult } from "pg";
|
||||
import path from "path";
|
||||
import { Word } from "../utils/types";
|
||||
import { Request, Response, Router } from "express";
|
||||
import fsp from "fs/promises";
|
||||
import { getPastePath, projectRoot } from "../utils";
|
||||
import path from "path";
|
||||
import { Pool } from "pg";
|
||||
import { getAvailableWord, getWordFromVal, setWordTaken } from "../db/bin";
|
||||
import { getPackedSettings } from "http2";
|
||||
import { getPastePath, projectRoot } from "../utils";
|
||||
import { Word } from "../utils/types";
|
||||
|
||||
export default function BinRouter(db: Pool) {
|
||||
const router: Router = Router();
|
||||
|
Reference in New Issue
Block a user