-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
37 lines (33 loc) · 964 Bytes
/
index.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
// require('./connection/db.connection');
const express = require('express');
const app = express();
// let articleModel = require('./models/Article')
const PORT = 4000;
const articleController = require('./controllers/articles')
app.set('view engine', 'ejs');
app.use('', articleController)
// app.get('/', async (req, res) => {
// try {
// let articles = await articleModel.find({})
// console.log(articles);
// context = {
// hello: articles
// }
// res.json(articles);
// } catch (err) {
// console.log(err);
// }
// })
// app.post('/', async (req, res) => {
// try {
// let article = req.body;
// await articleModel.create(article);
// let allArticles = articleModel.find({});
// res.json(allArticles);
// } catch(err) {
// console.log(err);
// }
// })
app.listen(PORT, function() {
console.log(`listening for port ${PORT}`)
})