Skip to content

Instantly share code, notes, and snippets.

@donjosef donjosef/posts.js
Created Sep 24, 2019

Embed
What would you like to do?
Define routes for handling requests
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
You can’t perform that action at this time.