Closed shubhamjaisingh closed 7 years ago
Hi, I am not getting to value from the form to the app console of my app.js code is below. please find the error.
app.js var express = require('express'); var app = express(); var port = process.env.PORT || 5000; var bodyParser = require('body-parser'); var nav = [{ Link: '/devices', Text: 'Device' }, { Link: '/about', Text: 'About Us' }, { Link: '/solution', Text: 'Solution' }, { Link: '/signup', Text: 'Sign Up' }, { Link: '/signin', Text: 'Sign In' }]; var deviceRouter = require('./src/routes/deviceRoutes.js')(nav); var adminRouter = require('./src/routes/adminRoutes.js')(nav); var authRouter = require('./src/routes/authRoutes.js')(nav); app.use(bodyParser.json()); app.use(bodyParser.urlencoded()); app.set('views', './src/views'); app.set('view engine', 'ejs'); app.use(express.static('public')); app.use('/devices', deviceRouter); app.use('/admin', adminRouter); app.use('/auth', authRouter); app.get('/', function (req, res) { res.render('index', { title:'Nodejs -UEDeveloper', nav: nav }); }); app.listen(port, function (err) { console.log('Running on port' + port); });
authRoutes.js var express = require('express'); var authRouter = express.Router(); var mongodb = require('mongodb').MongoClient;
var router = function(){ authRouter.post('/signup',function (req, res) { console.log(req.body); }); authRouter.post('/signin',function (req, res) { console.log(req.body); });
return authRouter; }; module.exports = router;
Hi, I am not getting to value from the form to the app console of my app.js code is below. please find the error.
app.js var express = require('express'); var app = express(); var port = process.env.PORT || 5000; var bodyParser = require('body-parser'); var nav = [{ Link: '/devices', Text: 'Device' }, { Link: '/about', Text: 'About Us' }, { Link: '/solution', Text: 'Solution' }, { Link: '/signup', Text: 'Sign Up' }, { Link: '/signin', Text: 'Sign In' }]; var deviceRouter = require('./src/routes/deviceRoutes.js')(nav); var adminRouter = require('./src/routes/adminRoutes.js')(nav); var authRouter = require('./src/routes/authRoutes.js')(nav); app.use(bodyParser.json()); app.use(bodyParser.urlencoded()); app.set('views', './src/views'); app.set('view engine', 'ejs'); app.use(express.static('public')); app.use('/devices', deviceRouter); app.use('/admin', adminRouter); app.use('/auth', authRouter); app.get('/', function (req, res) { res.render('index', { title:'Nodejs -UEDeveloper', nav: nav }); }); app.listen(port, function (err) { console.log('Running on port' + port); });
authRoutes.js var express = require('express'); var authRouter = express.Router(); var mongodb = require('mongodb').MongoClient;
var router = function(){ authRouter.post('/signup',function (req, res) { console.log(req.body); }); authRouter.post('/signin',function (req, res) { console.log(req.body); });
return authRouter; }; module.exports = router;