-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapi.js
52 lines (46 loc) · 908 Bytes
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* Dependencies
*/
const debug = require('debug')('collectify:api');
const http = require('http');
const express = require('express');
const lodash = require('lodash-fp');
const async = require('async');
const util = require('util');
const mongoose = require('mongoose');
const app = express();
/**
* Application-specific modules
*/
const config = require('./config');
const setup = require('./setup');
/**
* Data Models (mongoose)
*/
const Entries = require('./models/entry');
const Sources = require('./models/source');
/**
* Connect to the database
*/
setup.connectToDatabase(
mongoose,
config.get('database.mongo.url')
);
/**
* Route for fetching
* a collection of articles
*/
app.get('/articles', (req, res) => {
//..TODO
});
/**
* Route for fetching
* a specific article
*/
app.get('/articles/:url', (req, res) => {
//..TODO
});
/**
* Start server
*/
app.listen(3001);