-
Notifications
You must be signed in to change notification settings - Fork 75
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 #14 from rotsen91/modularize
Modularize Routes File
- Loading branch information
Showing
14 changed files
with
75 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "CVE-API", | ||
{ | ||
"name": "cve-services", | ||
"script": "./src/index.js", | ||
"instances": 0, | ||
"exec_mode": "cluster" | ||
} | ||
} |
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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
const express = require('express'); | ||
const router = express.Router() | ||
const controller = require('./cve.controller') | ||
|
||
router.post('/cve', controller.CVE_SUBMISSION); | ||
router.get('/cve-id', controller.CVE_ID_ALLOCATION); | ||
|
||
module.exports = router; |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
async function helloWorld(req, res) { | ||
console.log('Hello world, called.'); | ||
res.status(200).json({ | ||
message: 'Hello world! Api works!' | ||
}); | ||
} | ||
|
||
async function helloWorld2(req, res) { | ||
console.log('Hello world 2, called.'); | ||
res.status(200).json({ | ||
message: 'Hello world 2! Api works!' | ||
}); | ||
} | ||
module.exports = { | ||
hello : helloWorld, | ||
hello2 : helloWorld2 | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
const express = require('express'); | ||
const router = express.Router() | ||
const helloWorld = require('./hello-world') | ||
|
||
router.post('/hello', helloWorld.hello); | ||
router.get('/hello2', helloWorld.hello2); | ||
|
||
module.exports = router; |
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
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
const TestRoutes = require('./controller/test.controller') | ||
const Cve_Controller = require('./controller/cve.controller') | ||
|
||
module.exports = async function configureRoutes(app) { | ||
//localhost:3000/test/hello | ||
//localhost:3000/test/hello2 | ||
app.use('/test', TestRoutes); | ||
app.use('/api', Cve_Controller); | ||
|
||
} |