Created
September 24, 2019 18:21
-
-
Save donjosef/b87c4d9071fe1fd9ba2f655eb2c274d2 to your computer and use it in GitHub Desktop.
Define routes for handling requests
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
const express = require('express'); | |
const controller = require('../controllers/posts'); | |
const router = express.Router(); //router is like a mini express app, that we can plug into app.use() | |
//With this we are determining how our application will respond to get requests to /posts | |
router.get('/posts', controller.getPosts); | |
//With this we are determining how our application will respond to post requests to /post | |
router.post('/post', controller.createPost); | |
module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment