mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 10:38:26 +00:00
work on rest module
This commit is contained in:
parent
9c98bd901f
commit
876e79eddb
4 changed files with 62 additions and 35 deletions
|
|
@ -24,6 +24,7 @@
|
|||
exports.http = require('http'),
|
||||
exports.https = require('https'),
|
||||
exports.path = require('path'),
|
||||
exports.url = require('url'),
|
||||
exports.querystring = require('querystring'),
|
||||
|
||||
/* Needed Modules */
|
||||
|
|
|
|||
|
|
@ -4,28 +4,26 @@
|
|||
"use strict";
|
||||
|
||||
var DIR = process.cwd() + '/',
|
||||
main = require(DIR + 'lib/server/main.js'),
|
||||
SRVDIR = main.SRVDIR,
|
||||
main = require(DIR + 'lib/server/main'),
|
||||
Util = main.util,
|
||||
|
||||
APIURL = '/api/v1/';
|
||||
APIURL = '/api/v1/';
|
||||
|
||||
exports.rest = function(req, res, pCallBack){
|
||||
var lUrl = req.url,
|
||||
lMethod = req.method;
|
||||
|
||||
console.log(lUrl);
|
||||
/* if lUrl contains api url */
|
||||
if( Util.isContainStr(lUrl, APIURL) ){
|
||||
lUrl = lUrl.replace(APIURL, '');
|
||||
/**
|
||||
* rest interface
|
||||
* @pConnectionData {request, responce}
|
||||
*/
|
||||
exports.rest = function(pConnectionData){
|
||||
var lReq = pConnectionData.request,
|
||||
lRes = pConnectionData.response,
|
||||
lUrl = lReq.url,
|
||||
lMethod = lReq.method;
|
||||
|
||||
console.log(lUrl);
|
||||
}
|
||||
|
||||
console.log(req.url);
|
||||
console.log(lMethod);
|
||||
|
||||
Util.exec(pCallBack);
|
||||
|
||||
console.log(lMethod);
|
||||
|
||||
if( Util.isContainStr(lUrl, APIURL) )
|
||||
console.log('api !!!!!!!!!!!! ');
|
||||
/*
|
||||
switch(req.method){
|
||||
case 'GET':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue