Skip to content

Instantly share code, notes, and snippets.

@pravin772
Last active July 11, 2020 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pravin772/a1b12361f4ce89b717fc82127a1cb08a to your computer and use it in GitHub Desktop.
Save pravin772/a1b12361f4ce89b717fc82127a1cb08a to your computer and use it in GitHub Desktop.
API routes
const router = require("express").Router()
const auth = require("../middleware/auth")
router.get("/", (req, res) => {
res.status("200").json({"message": "Hello, Welcome"})
})
router.post("/login", auth.signToken)
router.get("/data", auth.verifyToken, (req, res) => {
res.status("200").json({email: req.decoded})
})
module.exports = router
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment