Provides easy access to [FileMaker](http://www.filemaker.com) Databases hosted on a FileMaker Server from [Sails.js](http://sailsjs.org/) & [Waterline](https://github.com/balderdashy/waterline). It can also be used with [hapi.js](http://hapijs.com/) throu
npm install sails-filemakerProvides easy access to FileMaker Databases hosted on a FileMaker Server from Sails.js & Waterline. It can also be used with hapi.js through dogwater, the hapi plugin for Waterline
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.
To install this adapter, run:
``sh`
$ npm install sails-filemaker
This adapter exposes the following methods:
###### find()
+ Status
+ implemented
###### create()
+ Status
+ implemented
###### update()
+ Status
+ implemented
###### destroy()
+ Status
+ implemented
This adapter implements the [semantic]() interfaces.
For more information, check out this repository's FAQ and the adapter interface reference in the Sails docs.
In config/connections.js create an entry for your FileMaker Server and Database, like any other adapter
`javascript`
'MyFMDataBase' : {
adapter: 'sails-filemaker',
host: '
database : 'DatabaseName',
userName: '
password : '
}
You can create more then one connection to the same server. Perhaps you need to connect to a second Database...
`javascript`
'MyOtherFMDataBase' : {
adapter: 'sails-filemaker',
host: '
database : 'AnotherDatabaseName',
userName: '
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.
#### Models
In your model, you will want to set a few attributes.
`javascript`
module.exports = {
// filemaker handles these
autoPK : false,
autoCreatedAt: false,
autoUpdatedAt: false,
// layout name
tableName : '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 : true,
unique : 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.
For example
`json`
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.
You will need to load the ContactsTest.fmp12 file on to your FileMaker Server. There is a copy of this file in test/fixtures/ContactsTest.fmp12
If your Server is not on localhost you will need to change the config in test/integration/runner.js
`javascript`
// Default adapter config to use.
config: {
adapter: 'sails-filemaker',
host: '
database: 'ContactsTest',
userName: 'admin',
password: ''
}
Then in your adapter's directory, run:
`sh`
$ npm test
See FAQ.md`.
- Stackoverflow
- #sailsjs on Freenode (IRC channel)
- Twitter
- Professional/enterprise
- Tutorials
-
MIT
© 2015 toddgeist
Todd Geist, geist interactive
Sails is free and open-source under the MIT License.