Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mongoose = require("mongoose");
- var Warga = require("../models/Warga");
- var wargaController = {};
- // controll untuk melakukan penyimpanan data inputan ke collection warga
- wargaController.save = function(req, res) {
- var warga = new Warga(req.body);
- warga.save(function(err) {
- if(err) {
- console.log(err);
- res.render('index');
- } else {
- console.log("Successfully created an warga.");
- res.redirect('../');
- }
- });
- };
- module.exports = wargaController;
Advertisement
Add Comment
Please, Sign In to add comment