Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added the error handling and docs support
  • Loading branch information
GauravWalia19 committed Oct 14, 2023
commit 04f2e985e4ed7e689e7c31b518b269d557a8372e
15 changes: 15 additions & 0 deletions api/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const express = require('express')
const cors = require('cors')
const rateLimit = require('express-rate-limit')
const {
badRequestHandler,
requestMethodHandler,
internalServerErrorHandler,
} = require('../src/errorHandler')

const app = express()

Expand Down Expand Up @@ -33,7 +38,17 @@ app.use(express.json())
// express middleware handling the form parsing
app.use(express.urlencoded({extended: false}))

// middleware to handle wrong method types
app.use(requestMethodHandler)

// middleware for handling sample api routes
app.use('/api/v1', require('../routes/api/v1/API'))
app.use(express.static('docs'))

// middleware to handle internal server errors due to implementation
app.use(internalServerErrorHandler)

// middleware to handle bad requests
app.use(badRequestHandler)

module.exports = app
7 changes: 7 additions & 0 deletions apidoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Code Rating Engine",
"version": "1.0.0",
"description": "Engine to handle the rating mechanisms for the clean code",
"title": "Code Rating Engine",
"url": "https://coderatingengine-techous.vercel.app"
}
Binary file added docs/assets/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/assets/bootstrap.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/assets/bootstrap.min.css.map

Large diffs are not rendered by default.

Binary file added docs/assets/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/favicon.ico
Binary file not shown.
Binary file added docs/assets/glyphicons-halflings-regular.eot
Binary file not shown.
288 changes: 288 additions & 0 deletions docs/assets/glyphicons-halflings-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/glyphicons-halflings-regular.ttf
Binary file not shown.
Binary file added docs/assets/glyphicons-halflings-regular.woff
Binary file not shown.
Binary file added docs/assets/glyphicons-halflings-regular.woff2
Binary file not shown.
110 changes: 110 additions & 0 deletions docs/assets/main.bundle.js

Large diffs are not rendered by default.

Loading