Permalink
Browse files

Get api/posts from db and send it

  • Loading branch information...
Nyweron committed Jun 28, 2017
1 parent 55a6ff0 commit 0c83d12f016ba3e0c8baec5180fa1141af6b20cc
Showing with 5 additions and 2 deletions.
  1. +5 −2 api/server.js
@@ -2,8 +2,11 @@ var express = require('express')
var Post = require('./models/post')
var app = express()
app.get('/', function(req, res) {
res.send('Hello Nyweron test!')
app.get('/api/posts', function(req, res, next) {
Post.find(function(err, posts) {
if (err) { return next(err) }
res.send(posts)
})
})
//use postman

0 comments on commit 0c83d12

Please sign in to comment.