Пример #1
0
 def __init__(self, DirectAPI: DirectAPIRegister, mongo: MongoClient):
     self.subjects = mongo.db.subjects
     DirectAPI.register('/subjects',
                        lambda: 'Here are some APIs about subjects')
     DirectAPI.register('/subjects/all', self.subjects_all)
     DirectAPI.register('/subjects/add', self.subjects_add)
     DirectAPI.register('/subjects/del', self.subjects_del)
Пример #2
0
from DirectAPIFramework import DirectAPIApp, DirectAPIRegister
from MongoOrm import MongoConnection
from APIs import RootAPI, SubjectsAPI, ClassesAPI, InspectorsAPI, RecordsAPI, AdminsAPI

if __name__ == '__main__':
    directApiRegister = DirectAPIRegister()
    mongo = MongoConnection('didsys')

    RootAPI(directApiRegister)
    SubjectsAPI(directApiRegister, mongo)
    ClassesAPI(directApiRegister, mongo)
    InspectorsAPI(directApiRegister, mongo)
    RecordsAPI(directApiRegister, mongo)
    AdminsAPI(directApiRegister, mongo)

    app = DirectAPIApp(8080, directApiRegister)
    app.run()
Пример #3
0
 def __init__(self, DirectAPI: DirectAPIRegister, mongo: MongoClient):
     self.admins = mongo.db.admins
     DirectAPI.register('/admins', lambda: 'Here are APIs about admins')
Пример #4
0
 def __init__(self, DirectAPI: DirectAPIRegister, mongo: MongoClient):
     self.records = mongo.db.records
     DirectAPI.register('/records', lambda: 'Here are APIs about records')
Пример #5
0
 def __init__(self, DirectAPI: DirectAPIRegister):
     DirectAPI.register('/author', lambda: "HankelBao")
     DirectAPI.register('/', lambda: "DIDSYS API System")
Пример #6
0
 def __init__(self, DirectAPI: DirectAPIRegister, mongo: MongoClient):
     self.inspectors = mongo.db.inspectors
     DirectAPI.register('/inspectors',
                        lambda: 'Here are APIs about inspectors')
Пример #7
0
 def __init__(self, DirectAPI: DirectAPIRegister, mongo: MongoClient):
     self.classes = mongo.db.classes
     DirectAPI.register('/classes', lambda: 'Here are APIs about classes')