Giter VIP home page Giter VIP logo

Comments (5)

Mordred avatar Mordred commented on July 4, 2024

Oh .. I see .. OK, withBaseUrl is not so good naming. We should rename it. It should be more like withPrefix or similar, but it is a breaking change. Maybe after Aurelia v1.0.0 release?

If you want to connect to another host, you must configure sails.io.js library directly. It is passed as second argument for config function of plugin.

aurelia.use
    .plugin('aurelia-sails-socket-client', (sails, io) => {
      sails.configure(x => {
        io.sails.url = 'http://localhost:9000';
        x.withBaseUrl('/api/v1');
      });
    });

from aurelia-sails-socket-client.

JasonWeise avatar JasonWeise commented on July 4, 2024

Thanks so much for helping with this, really appreciated.
I had dived into your src and did notice I could append the url to io.sails.url like you have demonstrated

After doing that I didn't think it was right as now after doing that I am getting a connection to the sails server ok but am receiving a CSRF error when trying to post a new todo.

The error in chrome console is now:

Unhandled promise rejection SocketResponseMessage {requestMessage: SocketRequestMessage, statusCode: 403, body: "CSRF mismatch", isSuccess: false, headers: Headers}

This is from the Aurelia App

from aurelia-sails-socket-client.

Mordred avatar Mordred commented on July 4, 2024

Yeah, this is little bit complicated. You have to setup your sails app. In your config/csrf.js make some changes:

module.exports.csrf = {
  grantTokenViaAjax: true,
  protectionEnabled: true,
  origin: 'http://localhost:1337',
  routesDisabled: '-'
};

Also CORS should be modified.

from aurelia-sails-socket-client.

johntom avatar johntom commented on July 4, 2024

Hi Jason,
See #7. Any chance you'd like to share and be a contributor.
John

from aurelia-sails-socket-client.

JasonWeise avatar JasonWeise commented on July 4, 2024

@Mordred thanks so much for all your assistance. This is working perfectly now as two separate front/end back end solutions. I appreciate all your help.
If you lived in Australia I'd deliberately go out of my way to come and buy you a beer next time I was in your neck of the woods (I travel a bit LOL)

@johntom once I have tidied up my code I'd be happy to help with what I have. As a regular contributor I'm not sure how much value I would be just now. I am just coming into the node world as I have always developed in C#, ASP.NET for our corporate web apps and have in the last 12 months produced two production apps with Meteor (that was a nice experience). I am loving the node ecosystem and LOVE Aurelia and Sails - this is the perfect fit for my next projects and @Mordred's work with this has sealed the deal with me. A lot of the Node/Express/...{WHATEVER MIDDLEWARE} stuff still has me scratching my head.. but I am loving it. - Thanks so much for the offer 👍

from aurelia-sails-socket-client.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.