Skip to content

Commit 2a82db1

Browse files
Merge pull request #7 from TECHOUS/dev
Added the API Docs
2 parents 71857be + 13a16e2 commit 2a82db1

29 files changed

+4412
-1299
lines changed

.github/job.js

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const connectMongoDB = () => {
3232
mongoose.connect(process.env.MONGODB_URI, {
3333
useNewUrlParser: true,
3434
useUnifiedTopology: true,
35-
useCreateIndex: true,
3635
})
3736
const db = mongoose.connection
3837
db.on('error', console.error.bind(console, 'Connection error:'))

api/app.js

+18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
const express = require('express')
22
const cors = require('cors')
33
const rateLimit = require('express-rate-limit')
4+
const path = require('node:path')
5+
const {
6+
badRequestHandler,
7+
requestMethodHandler,
8+
internalServerErrorHandler,
9+
} = require('../src/errorHandler')
410

511
const app = express()
612

@@ -21,6 +27,9 @@ const rateLimiter = rateLimit({
2127
// see https://expressjs.com/en/guide/behind-proxies.html
2228
app.set('trust proxy', 1)
2329

30+
// for hosting documentation on root
31+
app.use(express.static(path.join(__dirname, 'public')))
32+
2433
// rate limiting middleware
2534
app.use(rateLimiter)
2635

@@ -33,7 +42,16 @@ app.use(express.json())
3342
// express middleware handling the form parsing
3443
app.use(express.urlencoded({extended: false}))
3544

45+
// middleware to handle wrong method types
46+
app.use(requestMethodHandler)
47+
3648
// middleware for handling sample api routes
3749
app.use('/api/v1', require('../routes/api/v1/API'))
3850

51+
// middleware to handle internal server errors due to implementation
52+
app.use(internalServerErrorHandler)
53+
54+
// middleware to handle bad requests
55+
app.use(badRequestHandler)
56+
3957
module.exports = app
7.49 KB
Loading
28.3 KB
Loading
8.57 KB
Loading

api/public/assets/bootstrap.min.css

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/public/assets/bootstrap.min.css.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/public/assets/favicon-16x16.png

566 Bytes
Loading

api/public/assets/favicon-32x32.png

1.13 KB
Loading

api/public/assets/favicon.ico

24.3 KB
Binary file not shown.
Binary file not shown.

api/public/assets/glyphicons-halflings-regular.svg

+288
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.

api/public/assets/main.bundle.js

+143
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)