Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var express = require('express');
- var parser = require('body-parser');
- var path = require('path');
- var app = express();
- app.use(parser.urlencoded({ extended: false }));
- app.use(parser.json());
- app.use(function(req,res,next){
- res.locals.userValue = null;
- next();
- });
- app.set('view engine','ejs');
- app.set('views',path.join(__dirname,'views'));
- app.get('/',function(req,res){
- res.render('pag',{
- topicHead : 'Cadastrar',
- });
- console.log('Carregando a página de cadastro...');
- });
- var user = [];
- app.post('/c',function(req,res){
- var usuario = {
- user_login : req.body.login,
- user_name : req.body.name,
- user_pass : req.body.pass
- };
- user.push(usuario);
- console.log(usuario);
- res.render('resposta',{
- userValue : usuario,
- topicHead : 'Usuarios'
- });
- });
- app.listen(8080,function(){
- console.log('server running on port 8080');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement