Skip to content

Commit

Permalink
covert controller 2 js
Browse files Browse the repository at this point in the history
  • Loading branch information
elrrrrrrr committed Jul 29, 2014
1 parent 8ef37e0 commit a3b9d0e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 213 deletions.
8 changes: 8 additions & 0 deletions controllers/index.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = (exports ? this)

root.test = (req,res)->
res.send 'test'




214 changes: 8 additions & 206 deletions controllers/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 19 additions & 7 deletions routes/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
var express = require('express');
var request = require('request')
var router = express.Router();
var cwd = process.cwd();

var controller = require('../controllers/index')
var config = require('../utils/getConfig')
var request = require('request')

/* GET home page. */

router.get('/test',function(req,res){
res.send('xixix')
router.get('/test',function(req, res) {

controller.test(req, res)
})

router.get('/intro', function(req, res) {
res.sendfile('public/intro.html');
});

router.get('*',function(req,res){
//console

router.get('/console', function(req, res) {
res.sendfile('public/console.html')
})

router.post('/console', function(req, res){

})

//enable the proxy
router.get('*',function(req,res){
res.header("Content-Type", "application/json; charset=utf-8");
var _r = config.ajaxList[req.path]

Expand All @@ -26,9 +38,9 @@ router.get('*',function(req,res){
} else {
var url = config.apiPath + req.url
console.log(url)
req.pipe(request(url))
.pipe(res)
return
req.pipe(request(url))
.pipe(res)
return
}
})

Expand Down

0 comments on commit a3b9d0e

Please sign in to comment.