const AuthHandler = require('./handlers/auth');
const PostsHandler = require('./handlers/posts');
+const CommentsHandler = require('./handlers/comments');
const internals = {};
this._initializeAuthRoutes();
this._initializePostsRoutes();
+ this._initializeCommentsRoutes();
this._app.use(function * () {
}
+ // Initialize routes for comments
+
+ _initializeCommentsRoutes() {
+
+ const commentsHandler = new CommentsHandler({
+ ttl: this.ttl,
+ redis: this.redis
+ });
+ this._app.use(KoaRoute.get('/api/posts/:postId/comments', commentsHandler.findAll()));
+ this._app.use(KoaRoute.post('/api/posts/:postId/comments', commentsHandler.create()));
+ }
+
// Starts listening
_startServer() {