Added "api/" prefix to api routes.

Client updated to reflect changes.
This commit is contained in:
Harrison Deng 2022-04-05 17:24:41 -05:00
parent b2c4178482
commit 4aced5ed2d
2 changed files with 12 additions and 9 deletions

View File

@ -1,6 +1,9 @@
import axios from "axios"; import axios from "axios";
export const apiClient = axios.create({ const apiClientConf = {
baseURL: process.env.REACT_APP_API_HOST, baseURL: process.env.REACT_APP_API_HOST + "/api/",
timeout: 5000, timeout: 5000,
}); withCredentials: process.env.NODE_ENV === "development"
};
console.log(apiClientConf);
export const apiClient = axios.create(apiClientConf);

View File

@ -27,9 +27,9 @@ try {
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
console.log("We are running in development mode.");
mongoose.set("bufferCommands", false); // We want to know if there are connection issues immediately for development. Disables globally. mongoose.set("bufferCommands", false); // We want to know if there are connection issues immediately for development. Disables globally.
server.use(cors({ credentials: true, origin: "http://localhost:3000" }));
server.use(cors());
} }
// Docs: https://www.npmjs.com/package/body-parser // Docs: https://www.npmjs.com/package/body-parser
@ -38,10 +38,10 @@ server.use(bodyParser.urlencoded({ extended: true }));
server.use(userSession); server.use(userSession);
server.use("/user", UserController); server.use("/api/user", UserController);
server.use("/match", MatchController); server.use("/api/match", MatchController);
server.use("/sport", SportController); server.use("/api/sport", SportController);
server.use("/rental", rentalController); server.use("/api/rental", rentalController);
server.listen(port, () => { server.listen(port, () => {
console.log(`Server listening on port ${port}.`); console.log(`Server listening on port ${port}.`);