access token endpoints and other backend support

This commit is contained in:
Milo Schwartz 2024-12-18 23:14:26 -05:00
parent 283fb3990c
commit 72dc02ff2e
No known key found for this signature in database
22 changed files with 905 additions and 107 deletions

View file

@ -4,29 +4,34 @@ import cors from "cors";
import cookieParser from "cookie-parser";
import config from "@server/config";
import logger from "@server/logger";
import { errorHandlerMiddleware, notFoundMiddleware } from "@server/middlewares";
import {
errorHandlerMiddleware,
notFoundMiddleware
} from "@server/middlewares";
import internal from "@server/routers/internal";
const internalPort = config.server.internal_port;
export function createInternalServer() {
const internalServer = express();
const internalServer = express();
internalServer.use(helmet());
internalServer.use(cors());
internalServer.use(cookieParser());
internalServer.use(express.json());
internalServer.use(helmet());
internalServer.use(cors());
internalServer.use(cookieParser());
internalServer.use(express.json());
const prefix = `/api/v1`;
internalServer.use(prefix, internal);
const prefix = `/api/v1`;
internalServer.use(prefix, internal);
internalServer.use(notFoundMiddleware);
internalServer.use(errorHandlerMiddleware);
internalServer.use(notFoundMiddleware);
internalServer.use(errorHandlerMiddleware);
internalServer.listen(internalPort, (err?: any) => {
if (err) throw err;
logger.info(`Internal server is running on http://localhost:${internalPort}`);
});
internalServer.listen(internalPort, (err?: any) => {
if (err) throw err;
logger.info(
`Internal server is running on http://localhost:${internalPort}`
);
});
return internalServer;
}
return internalServer;
}