Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. module.exports = function(app) {
  2. return function(req, res, next) {
  3. const body = req.body;
  4. app.service('users').create({
  5. email: body.email,
  6. password: body.password
  7. })
  8. // Then redirect to the login page
  9. .then(user => res.redirect('/login.html'))//this will be a redirect in my client not in the server
  10. .catch(next);
  11. };
  12. };
  13.  
  14. module.exports = function() {
  15. const app = this;
  16.  
  17. app.post('/signup', signup(app));// how can I reimplement this with sockets
  18. app.use(notFound());
  19. app.use(logger(app));
  20. app.use(handler());
  21. };
  22.  
  23. request.post(`${SERVER}/signup`)
  24. .send({ email: username, password: password })
  25. .then(data=>{console.log(`data comming from response`,data)})
  26. .catch(error=>{console.log(`ERROR comming from response`,error)})
  27.  
  28. import feathers from 'feathers-client';
  29. const io = require('socket.io-client');
  30. var socket = io(SERVER);
  31.  
  32.  
  33. let feathersClient =
  34. feathers()
  35. .configure(feathers.socketio(socket))
  36. .configure(feathers.hooks())
  37. .configure(feathers.authentication({
  38. storage: window.localStorage
  39. }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement