在运行时node.js

时间:2016-12-03 09:20:03

标签: node.js api

是否可以在运行时配置 apiMiddleware &前往各自的班级或api。

E.g  class standard = 1st
     section  = A

http://myschool.com/school/1/A/attendance 

var apiMiddleware = {

    school : {

        get : {

            //class id = 1
            1 : {  
                A : {
                   attendance : myschool.attendance
                }            

            }
        },
        post : {

        }
    }

}

根据上面的例子,我正在检索第一节a的出勤表。

如果我是第一节B的出勤表,我不想重写相同的代码

A : {
    attendance : myschool.attendance
  } 
B : {
    attendance : myschool.attendance
 } 

直到..... 12th std。

在那里,专家可能会遇到这个问题&找到了解决方案。很高兴听到关于同样的建议。

0 个答案:

没有答案
相关问题