Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var express = require('express');
- var router = express.Router();
- var mongojs = require('mongojs');
- var bcrypt = require('bcrypt');
- var mongoose = require('mongoose');
- var Schema = mongoose.Schema;
- var userschema = new Schema({
- uname: String,
- uemail: String
- });
- var db = mongojs('mongodb://admin:admin@ds133776.mlab.com:33776/project',
- ['users']);
- mongoose.connect('mongodb://admin:admin@ds133776.mlab.com:33776/project');
- var users = mongoose.model('users', userschema);
- router.get('/cats', function(req, res){
- users.find({'uname' : 'Pulkit'}, function(err,arr){
- res.render('../views/addproduct.html', {pname: arr});
- });
- });
- module.exports = router;
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Add Product</title>
- </head>
- <body>
- <h1>Please fill the product details</h1>
- <p name="pname"></p>
- <form>
- <label>Product Name :<input type="text" required ></label>
- <label>Category Id :
- <select name="catid">
- <option value="volvo">Volvo</option>
- <option value="saab">Saab</option>
- <option value="mercedes">Mercedes</option>
- <option value="audi">Audi</option>
- </select>
- </label>
- <label>Product Name :<input type="text" required ></label>
- </form>
- </body>
Add Comment
Please, Sign In to add comment