Last active
July 11, 2020 09:31
-
-
Save pravin772/a1b12361f4ce89b717fc82127a1cb08a to your computer and use it in GitHub Desktop.
API routes
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 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