generated from Open-Science-Community-Saudi-Arabia/Template
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #368 from Open-Science-Community-Saudi-Arabia/fix_…
…documentation Fix documentation and removed redundant code files.
- Loading branch information
Showing
37 changed files
with
1,550 additions
and
2,121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
const express = require("express"); | ||
const morgan = require("morgan"); | ||
const cors = require('cors'); | ||
require('express-async-errors') | ||
const cookieParser = require('cookie-parser') | ||
const cors = require("cors"); | ||
require("express-async-errors"); | ||
const cookieParser = require("cookie-parser"); | ||
const errorHandler = require("./middlewares/error_handler"); | ||
const app = express(); | ||
const session = require("express-session"); | ||
const UUID = require("uuid").v4; | ||
|
||
// Middlewares | ||
if (process.env.NODE_ENV == "dev") app.use(morgan("dev")); | ||
app.use(cors()) | ||
app.use(cors()); | ||
app.use(cookieParser()); | ||
app.use(express.json()); | ||
|
||
// Route handler | ||
require("./routes/routes_handler")(app); | ||
|
||
// Error handler middleware | ||
app.use(errorHandler); | ||
app.use((req, res, next) => { | ||
res.status(404).json({ | ||
status: "fail", | ||
message: `Can't find ${req.originalUrl} on this server!`, | ||
}); | ||
res.status(404).json({ | ||
status: "fail", | ||
message: `Can't find ${req.originalUrl} on this server!`, | ||
}); | ||
}); | ||
|
||
module.exports = app; |
Oops, something went wrong.