2017-05-09 15:42:06 +03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const express = require('express');
|
|
|
|
|
|
|
|
const TaskService = require('./task-service');
|
|
|
|
const dao = new TaskService();
|
|
|
|
const app = express();
|
|
|
|
|
|
|
|
app.get('/api/tasks', getTasks);
|
|
|
|
|
|
|
|
app.listen(3000, () => console.log('Server is running...'));
|
|
|
|
|
2017-05-09 15:51:03 +03:00
|
|
|
function getTasks(request, response) {
|
2017-05-09 15:42:06 +03:00
|
|
|
dao.getTasks()
|
2017-05-09 15:51:03 +03:00
|
|
|
.then(tasks => {
|
|
|
|
console.log(tasks);
|
|
|
|
response.end('ok');
|
|
|
|
});
|
2017-05-09 15:42:06 +03:00
|
|
|
}
|