Browse Source

added post request to server.js for Vivi

pull/1/head
Senta Mandutz 5 years ago
parent
commit
5c7ad18abd
2 changed files with 26 additions and 1 deletions
  1. 9
    1
      public/index.html
  2. 17
    0
      server.js

+ 9
- 1
public/index.html View File

@@ -79,7 +79,7 @@
<router-link to="/bookmark" class="nav-item nav-link"><i class="material-icons">bookmark</i></router-link>
<router-link to="/profil" class="nav-item nav-link"><i class="material-icons">person</i></router-link>
</nav>
</div>

<script>

@@ -94,6 +94,14 @@
const router = new VueRouter({
routes
});
var app = new Vue({
router,
el: '#api',
methods: {

},
});

</script>

<!-- CDN_Vue.js minified lib -->

+ 17
- 0
server.js View File

@@ -131,6 +131,23 @@ app.get ("/api/msg/:id", function (req, res) {
});
});

app.post("/api/createMsg", function(req, res){
var message = new Message(req.body);

message.save(function(err,result){
if(err)
return res .status(401) .send(err.message);

res.json({message: "Message created!!"});
});
});

// Other stuff is NOT authorized unless logged in
//app.use (authorize.genCheckAuthorized ('user'));

// Uploaded files
//app.use ('/uploads', expr ess.static(__dirname + '/uploads'));

// Other stuff is NOT authorized unless logged in
//app.use (authorize.genCheckAuthorized ('user'));


Loading…
Cancel
Save