Git Product home page Git Product logo

Comments (4)

DominusKelvin avatar DominusKelvin commented on June 20, 2024 1

Hey @chauhankiran nice tinkering, so ideally you'd want to scaffold a new Sails project with sails new so you get all the framework code necessary to have a Sails application, which includes setting up required Sails hooks(which include models), and loading core modules.

That said, if you'd like a course to sort of help you understand how to get started with Sails, you can check out the Getting Started with Sails course on Sailscasts(I'll gift you the course for free, just send over your email)

Also you can join the Sailscasts community to ask your Sails questions.

from sails.

sailsbot avatar sailsbot commented on June 20, 2024

@chauhankiran Thanks for posting! We'll take a look as soon as possible.

In the mean time, there are a few ways you can help speed things along:

  • look for a workaround. (Even if it's just temporary, sharing your solution can save someone else a lot of time and effort.)
  • tell us why this issue is important to you and your team. What are you trying to accomplish? (Submissions with a little bit of human context tend to be easier to understand and faster to resolve.)
  • make sure you've provided clear instructions on how to reproduce the bug from a clean install.
  • double-check that you've provided all of the requested version and dependency information. (Some of this info might seem irrelevant at first, like which database adapter you're using, but we ask that you include it anyway. Oftentimes an issue is caused by a confluence of unexpected factors, and it can save everybody a ton of time to know all the details up front.)
  • read the code of conduct.
  • if appropriate, ask your business to sponsor your issue. (Open source is our passion, and our core maintainers volunteer many of their nights and weekends working on Sails. But you only get so many nights and weekends in life, and stuff gets done a lot faster when you can work on it during normal daylight hours.)
  • let us know if you are using a 3rd party plugin; whether that's a database adapter, a non-standard view engine, or any other dependency maintained by someone other than our core team. (Besides the name of the 3rd party package, it helps to include the exact version you're using. If you're unsure, check out this list of all the core packages we maintain.)

Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.

For help with questions about Sails, click here.

from sails.

chauhankiran avatar chauhankiran commented on June 20, 2024

Something like this in lib/app/private/exposeGlobals.js. Just a suggestion. Please guide on this if it is incorrect or wrong.

Instead of throwing error, set false to the option.

// `sails.config.globals._` must be false or an object.
// (it's probably a function with lots of extra properties, but to future-proof, we'll allow any type of object)
if (sails.config.globals._ !== false) {
  if (!_.isObject(sails.config.globals._)) {
    // throw flaverr(
    //   { name: "userError", code: "E_BAD_GLOBAL_CONFIG" },
    //   new Error(
    //     "As of Sails v1, `sails.config.globals._` must be either `false` or a locally-installed version of Lodash (typically `require('lodash')`).  For more info, see http://sailsjs.com/config/globals"
    //   )
    // );
    global["_"] = false;
  }
  global["_"] = sails.config.globals._;
}
// `sails.config.globals.async` must be false or an object.
// (it's probably a plain object aka dictionary, but to future-proof, we'll allow any type of object)
if (sails.config.globals.async !== false) {
  if (!_.isObject(sails.config.globals.async)) {
    // throw flaverr(
    //   { name: "userError", code: "E_BAD_GLOBAL_CONFIG" },
    //   new Error(
    //     "As of Sails v1, `sails.config.globals.async` must be either `false` or a locally-installed version of `async` (typically `require('async')`)  For more info, see http://sailsjs.com/config/globals"
    //   )
    // );
    global["async"] = false;
  }
  global["async"] = sails.config.globals.async;
}

// `sails.config.globals.sails` must be a boolean
if (sails.config.globals.sails !== false) {
  if (sails.config.globals.sails !== true) {
    // throw flaverr(
    //   { name: "userError", code: "E_BAD_GLOBAL_CONFIG" },
    //   new Error(
    //     "As of Sails v1, `sails.config.globals.sails` must be either `true` or `false` (Tip: you may need to uncomment the `sails` setting in your `config/globals.js` file).  For more info, see http://sailsjs.com/config/globals"
    //   )
    // );
    global["sails"] = true;
  }
  global["sails"] = sails;
}

// `sails.config.globals.models` must be a boolean.
// `orm` hook takes care of actually globalizing models and adapters (if enabled)
if (
  sails.config.globals.models !== false &&
  sails.config.globals.models !== true
) {
  // throw flaverr(
  //   { name: "userError", code: "E_BAD_GLOBAL_CONFIG" },
  //   new Error(
  //     "As of Sails v1, `sails.config.globals.models` must be either `true` or `false` (you may need to uncomment the `models` setting in your `config/globals.js` file).  For more info, see http://sailsjs.com/config/globals"
  //   )
  // );
  sails.config.globals.models = true;
}

TODO: Also something for globals.js file as well.

from sails.

DominusKelvin avatar DominusKelvin commented on June 20, 2024

Hey @chauhankiran would you say this issue has been resolved yet or do you need further help 😃?

from sails.

Related Issues (20)

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.