Skip to content

Commit

Permalink
chore: add cors
Browse files Browse the repository at this point in the history
  • Loading branch information
tonalmathew committed Oct 1, 2021
1 parent f3b0c20 commit c8f0e01
Show file tree
Hide file tree
Showing 3 changed files with 5,339 additions and 28 deletions.
33 changes: 18 additions & 15 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
const express = require('express')
const morgan = require('morgan')
const express = require("express");
const morgan = require("morgan");
const cors = require("cors");

const userRouter = require('./src/routes/user.router')
const postRouter = require('./src/routes/post.router')
const rootRouter = require('./src/routes/root.router')
const healthRouter = require('./src/routes/health.router')
const userRouter = require("./src/routes/user.router");
const postRouter = require("./src/routes/post.router");
const rootRouter = require("./src/routes/root.router");
const healthRouter = require("./src/routes/health.router");

const app = express()
const app = express();

if (process.env.NODE_ENV == 'development') {
app.use(morgan('dev'))
app.use(cors());

if (process.env.NODE_ENV == "development") {
app.use(morgan("dev"));
}

app.use(express.json())
app.use(express.json());

app.use('/health', healthRouter)
app.use('/api/v1/user', userRouter)
app.use('/api/v1/post', postRouter)
app.use('/*', rootRouter)
app.use("/health", healthRouter);
app.use("/api/v1/user", userRouter);
app.use("/api/v1/post", postRouter);
app.use("/*", rootRouter);

module.exports = app
module.exports = app;
Loading

0 comments on commit c8f0e01

Please sign in to comment.