title: Clear LocalStorage from server-side
body: <p>Hello I need to clear() my localstorage from the server-side.</p>
  
  <p>The right moment is after inserting some info in the db (info took from the localstorage) and then I need to redirect and clear the localstorage..</p>
  
  <p>I tried with node-localstorage but i can't do it from the controller...</p>
  
  <p>edit:</p>
  
  <p>Im working on Node.js so its Javascript Server Side..</p>
  
  <p>part of the code:</p>
  
  <pre><code>var mPA = require('../models/mPedidosAbastecimiento');
  var mysql = require('mysql');
  var async = require('async');
  var LocalStorage = require('node-localstorage').LocalStorage,
  localStorage = new LocalStorage('./scratch');
  
   function postAlta(req, res){
      params = req.body;
      var objDatos = params.objDatos;
      var objDatosParsed = "";
      tipo_de_objDatos = typeof objDatos;
  
      if (tipo_de_objDatos == "string"){      
          objDatosParsed = JSON.parse(objDatos);          
      }else if (tipo_de_objDatos == "object"){
          stringiii = JSON.stringify(objDatos);
          objDatosParsed = JSON.parse(stringiii); 
      } else {
          console.log("No es ni string ni object, es: "+tipo_de_objDatos);
      }
  
      var aArt = objDatosParsed.aArticulos;
      var fecha_generacion = params.fecha_generacion;
      var id_sector = params.sector;
  
      var connection = mysql.createConnection({
          user: 'xxx',
          password: 'xxx',
          host: 'xxx.xxx.xxx.xxx',
          port: 'xxx',
          database: 'xxx',
          dateStrings : xxx
      });
  
      connection.connect();
  
      mPA.getLastNroPa(function (ultimo_nro_pa){
  
          ultimo_nro_pa = ultimo_nro_pa[0].nro_pa;
          var nro_pa = 1;
  
          if (ultimo_nro_pa != 0)
              nro_pa = ultimo_nro_pa+1;
  
          fecha_generacion = changeDate(fecha_generacion);
  
          async.eachSeries(aArt, function (articulo, callback) {
              var id_articulo = articulo.id_articulo_fk;
              var id_responsable = articulo.id_responsable_fk;
              var id_centro_costo = articulo.id_centrocosto_fk;
              var fecha_necesidad = articulo.fecha_necesidad;
              var urgente = articulo.urgente;
              var cantidad = articulo.cantidad;
  
              fecha_necesidad = changeDate(fecha_necesidad);          
  
              var query= "insert into pedidos_abastecimiento(nro_pa, fecha_gen, id_centrocosto_fk, id_responsable_fk, fecha_necesidad, "
                  +"id_articulo_fk, cantidad, urgente, id_sector_fk) "+
                  "values("+nro_pa+", '"+fecha_generacion+"', "+id_centro_costo+", "+id_responsable+", '"+fecha_necesidad+"', "
                      +id_articulo+", "+cantidad+", "+urgente+", "+id_sector+")"
  
              connection.query(query, function (err, rows, fields) {
                  if (err){
                      throw err;
                      console.log(err)
                  }else{
                      console.log("No errors in the query.");
                      console.log(query);
                      callback();
                  }
              });
  
          }, function (err) {
              //HERE IS WHERE I NEE TO CLEAR THE LOCALSTORAGE SO 'paalta' CAN RENDER WITHOUT ANY DATA LISTED
              localStorage.clear();           
              connection.end();
              res.redirect('paalta');
          });     
      });     
  }
  </code></pre>