-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
26 lines (16 loc) · 829 Bytes
/
app.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
const express = require('express');
const cors = require('cors');
const app = express();
const { getAllTopics, getAllEndPoints, getArticlesById, getAllArticles, getCommentsByArticleId, postNewComment, updateArticleById, deleteCommentById, getAllUsers } = require('./controllers/topics.controllers')
app.use(express.json());
app.use(cors());
app.get('/api/topics', getAllTopics);
app.get('/api', getAllEndPoints);
app.get('/api/articles/:article_id', getArticlesById);
app.get('/api/articles', getAllArticles);
app.get('/api/articles/:article_id/comments', getCommentsByArticleId);
app.post('/api/articles/:article_id/comments', postNewComment);
app.patch('/api/articles/:article_id', updateArticleById);
app.delete('/api/comments/:comment_id', deleteCommentById)
app.get('/api/users', getAllUsers)
module.exports = app;