Created
July 19, 2017 12:48
-
-
Save mhdatie/62f6b2286dc05c9395b481472001f2d8 to your computer and use it in GitHub Desktop.
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 router = express.Router(); | |
const mainController = require('../controllers'); | |
const pj = require('../package.json'); | |
/* GET home page. */ | |
router.get('/', (req, res) => { | |
res.status(200).json({ name: pj.name, version: pj.version}); | |
}); | |
/* Create a short URL */ | |
router.post('/', mainController.saveUrl); | |
/* Get original URL */ | |
router.get('/:code', mainController.getUrl); | |
module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment