<file_sep>'use strict';

var app = angular.module('ToDoList', ['ngTable']);<file_sep>'use strict';

global.__base = __dirname + '/';

require('dotenv').config();
require(`${__base}app`);<file_sep>'use strict';

const express = require('express'),
      bodyParser = require('body-parser'),
      Bluebird = require('bluebird'),
      http = require('http'),
      app = express(),
      server = http.createServer(app),
      fs = Bluebird.promisifyAll(require('fs'));

app.set('view engine', 'pug');
app.set('views', `${__base}app/views`);
app.use(bodyParser.json({'extended': true}));
app.use('/static', express.static(`${__base}public`));
app.get('/', (req, res) => {
    res.render('index');
});
app.get('/public/lodash/lodash.js', (req, res) => {
    fs.readFileAsync(`${__base}node_modules/lodash/lodash.js`)
    .then(data => res.send(data))
    .catch(e => res.status(500).send(e));
});

require(`${__base}app/server/router`)(app);

app.listen(process.env.PORT, () => {
    console.log(`Todo application up and running on port ${process.env.PORT}`);
});
<file_sep># Aplicação 2 - To-do list

## Getting started:

```bash
$ git clone <EMAIL>:desoares1975/to-do-list.git
```
### After clonning on the same folder:

```bash
$ cd to-do-list
```
```bash
$ npm install
```

Save the file in the main folder .env.sample as .env
```bash
$cp .env.sample .env
```

## Starting application

```bash
$ node index.js
```
<file_sep>'use strict';

const todos = require(`${__base}app/server/router/todos`);

module.exports = app => {
    app.post('/todo', todos.create);
    app.get('/todo', todos.list);
    app.get('/todo/:_id', todos.read);
    app.put('/todo/:_id', todos.update);
    app.delete('/todo/:_id', todos.delete);
};