FileMaker is a different sort of database then typically used with Sails.js. This adapter is connects through FileMaker Server's Custom Web Publishing interface. see guide.
NOTE TO FILEMAKER USERS: You really need to have at least some experience installing and running nodejs based projects. If you don't have nodejs and sailsjs installed, start there. You won't be able to get far without being able to get those installed and running.
You can watch this short video on how to get setup and running with sails-filemaker. The example below was creating during the screencast.
Take a look at this repo to see an example that connects to a FileMaker database running on localhost.
To install this adapter, run:
$ npm install sails-filemaker
This adapter exposes the following methods:
config/connections.js create an entry for your FileMaker Server and Database, like any other adapter
'MyFMDataBase' :adapter: 'sails-filemaker'host: '<your server address>'database : 'DatabaseName'userName: '<userName>'password : '<password>'
You can create more then one connection to the same server. Perhaps you need to connect to a second Database...
'MyOtherFMDataBase' :adapter: 'sails-filemaker'host: '<your server address>'database : 'AnotherDatabaseName'userName: '<userName>'password : '<password>'
FileMaker's Custom Web Publishing uses Layouts to access the underlying tables. So Sails models for filemaker connect to Layouts not Tables. Layouts are sort of like views in that they specify a table, and a set of fields. They can even specify a set of related records and fields. But they do not specify queries.
In your model, you will want to set a few attributes.
moduleexports =// filemaker handles theseautoPK : falseautoCreatedAt: falseautoUpdatedAt: false// layout nametableName : 'Contacts'// you MUST set up the primaryKey!// Setting up other attributes/fields is not required// unless you want conversion between JS and FileMaker ( i.e. date fields )attributes:id :type : 'string'primaryKey : trueunique : true;
This adapter follows the Sails convention of using the file name to derive the layout name. So a User.js model file will connect to a User layout in FileMaker. If you want to use a different name for your layout, you can set the "tableName" property on the model.
tableName : 'webContacts'
Would tell the model to connect to a layout named "webContacts", regardless of it's file name.
This is useful for FileMaker, since it is a common practice to use naming conventions to denote layouts that are only used for web access.
Check out Connections in the Sails docs, or see the
config/connections.js file in a new Sails project for information on setting up adapters.
NOTE: you only need to run the tests if you are contributing to this project. You do not need to run the tests if you just want to use this in your sails-project.
You will need to load the ContactsTest.fmp12 file on to your FileMaker Server. There is a copy of this file in
If your Server is not on localhost you will need to change the config in
// Default adapter config to use.config:adapter: 'sails-filemaker'host: '<localhost>' // change to your serverdatabase: 'ContactsTest'userName: 'admin'password: ''
Then in your adapter's directory, run:
$ npm test