Skip to content

Instantly share code, notes, and snippets.

@mhdatie
Created July 19, 2017 12:48
Show Gist options
  • Save mhdatie/62f6b2286dc05c9395b481472001f2d8 to your computer and use it in GitHub Desktop.
Save mhdatie/62f6b2286dc05c9395b481472001f2d8 to your computer and use it in GitHub Desktop.
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