Created
August 4, 2021 18:56
-
-
Save phpmaps/6dc06a41fbdfd052cce737fa9da39da1 to your computer and use it in GitHub Desktop.
server/api/index.js
This file contains hidden or 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
| const express = require('express'); | |
| const exampleRouter = require('./exampleRouter'); | |
| const membersRouter = require('./membersRouter'); | |
| const router = express.Router() | |
| /** | |
| * main api endpoint | |
| **/ | |
| router.route('/') | |
| .get((req, res) => { | |
| res.json({ | |
| message: 'API - ππππ' | |
| }); | |
| }) | |
| /** | |
| * handle endpoints off of /api | |
| **/ | |
| router.use('/example', exampleRouter); // ex. /api/example | |
| router.use('/members', membersRouter); // ex. /api/members | |
| module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment