Implemented read json courses
This commit is contained in:
parent
a1de036338
commit
fc5c786b00
4 changed files with 47 additions and 28 deletions
|
@ -6,6 +6,8 @@ import 'package:logging/logging.dart';
|
|||
import 'package:rpc/rpc.dart';
|
||||
|
||||
import '../lib/server/titamaapi.dart';
|
||||
import '../lib/server/titamaio.dart';
|
||||
import '../lib/common/messages.dart';
|
||||
|
||||
final ApiServer _apiServer = new ApiServer(prettyPrint: true);
|
||||
|
||||
|
@ -14,7 +16,10 @@ main() async {
|
|||
..level = Level.INFO
|
||||
..onRecord.listen(print);
|
||||
|
||||
_apiServer.addApi(new TitamaApi());
|
||||
// read saved data
|
||||
List<Course> courses = await new TitamaIo().readJson();
|
||||
|
||||
_apiServer.addApi(new TitamaApi(courses));
|
||||
|
||||
HttpServer server = await HttpServer.bind(InternetAddress.ANY_IP_V4, 8080);
|
||||
server.listen(_apiServer.httpRequestHandler);
|
||||
|
|
Reference in a new issue