Q:

Connect Sails JS to SQL Server EXPRESS

I'm learning Sails JS (and NodeJS), and I'm trying to set a connection to SQL Server Express.  What I have so far:
A database called test-project-db with a table inside called TestTable1.  It has two columns: name varchar(20) and description varchar(100). 
A sails project generated with sails new, and a model/component made with sails generate api TestTable1. 
My files:
- api/models/TestTable1.js
module.exports = {

  attributes: {

    name: {
      type: 'string',
    },

    description: {
      type: 'string',
    },

  }
};

- config/connections.js:
sqlserver: {
    adapter : 'sails-sqlserver',
    user    : 'sa',
    password: 'passw',
    host    : 'localhost\\SQLEXPRESS',
    database: 'test-project-db'
  }

- config/models.js:
module.exports.models = {

  connection: 'sqlserver',

  migrate: 'safe',

};

But when I run the server with sails lift and go to localhost:1337/testtable1, I get the error:
(node:15756) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ConnectionError: Failed to connect to localhost:undefined in 60000ms
(node:15756) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated.  In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 

And, if instead of sails-sqlserver I use sails-mssqlserver, I get (in the console):
{"name":"Sails-MSSqlserver","hostname":"DESKTOP-PMN0K03","pid":15928,"level":30,"msg":"Error in __FIND__: { ConnectionError: Failed to connect to localhost:undefined in 60000ms\n    at Connection.<anonymous> (D:\\Práctica 2\\test-project\\node_modules\\sails-mssqlserver\\node_modules\\mssql\\lib\\tedious.js:378:25)\n    at Object.onceWrapper (events.js:315:30)\n    at emitOne (events.js:116:13)\n    at Connection.emit (events.js:211:7)\n    at Connection.connectTimeout
(D:\\Práctica 2\\test-project\\node_modules\\sails-mssqlserver\\node_modules\\tedious\\lib\\connection.js:467:12)\n    at ontimeout (timers.js:475:11)\n    at tryOnTimeout (timers.js:310:5)\n    at Timer.listOnTimeout (timers.js:270:5)\n  name: 'ConnectionError',\n  message: 'Failed to connect to localhost:undefined in 60000ms',\n  code: 'ETIMEOUT' }","time":"2018-01-31T19:00:27.325Z","v":0}
error: Sending 500 ("Server Error") response:
 Error (E_UNKNOWN) :: Encountered an unexpected error
ConnectionError: Failed to connect to localhost:undefined in 60000ms
    at Connection.<anonymous> (D:\Práctica 2\test-project\node_modules\sails-mssqlserver\node_modules\mssql\lib\tedious.js:378:25)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Connection.emit (events.js:211:7)
    at Connection.connectTimeout (D:\Práctica 2\test-project\node_modules\sails-mssqlserver\node_modules\tedious\lib\connection.js:467:12)
    at ontimeout (timers.js:475:11)
    at tryOnTimeout (timers.js:310:5)
    at Timer.listOnTimeout (timers.js:270:5)

Details:  ConnectionError: Failed to connect to localhost:undefined in 60000ms

And in the browser:
[Error (E_UNKNOWN) Encountered an unexpected error] Details:  ConnectionError: Failed to connect to localhost:undefined in 60000ms

Along a 500 error page. 
Any idea on what am I doing wrong? 

A:

localhost:undefined --> The port is undefined because you didn't provide it in the configuration.  Add in the port attribute into your sqlserver connection within config/connections.js, and assign it your database server's port. 
Side note: learning Sails while learning Node is quite a handful, especially since Sails can look intimidating at first.  Just take it piece by piece, and you'll definitely get a hang of it.  If you're familiar with MVC frameworks, such as Rails, then Sails will feel right at home.