home.js 984 B

12345678910111213141516171819202122232425262728
  1. var express = require('express');
  2. var router = express.Router();
  3. /* GET home page. */
  4. router.get('/', function(req, res, next) {
  5. res.header("Access-Control-Allow-Origin", "*");
  6. res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  7. res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
  8. res.header("X-Powered-By",'3.2.1');
  9. res.header("Vary","Origin");
  10. res.header("Content-Type", "application/json;charset=utf-8");
  11. var protocol = req.protocol;
  12. var host = req.host;
  13. var ip = req.ip;
  14. return res.send({
  15. code:200,
  16. info:'Welcome, This is a wonderful site',
  17. ip:ip,
  18. links:{
  19. v1: protocol + '://' + host + '/v1/',
  20. home:'https://github.com/xCss/JsonBird',
  21. HowToUse:'https://github.com/xCss/JsonBird#how-to-use',
  22. issue:'https://github.com/xCss/JsonBird/issues'
  23. }
  24. });
  25. });
  26. module.exports = router;