-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature #159068410] Add /GET entries endpoint
- Loading branch information
1 parent
a5f41df
commit d983b34
Showing
3 changed files
with
30 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import entries from '../db/entries'; | ||
|
||
const getAllEntries = (req, res) => { | ||
res.status(200).json(entries); | ||
}; | ||
|
||
export default getAllEntries; |
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,11 +1,14 @@ | ||
import express from 'express'; | ||
// import Entry from '../models/entry'; | ||
import getAllEntries from '../controllers/getAllEntries'; | ||
|
||
const router = express.Router(); | ||
|
||
/* GET home page. */ | ||
/* GET API base */ | ||
router.get('/', (req, res) => { | ||
res.json({ Hello: 'World' }); | ||
res.json({ MyDiary: 'API v1' }); | ||
}); | ||
|
||
/* GET all user entries */ | ||
router.get('/entries', getAllEntries); | ||
|
||
export default 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