npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hapi-fm-rest

v1.0.0

Published

"A RESTFul JSON Server for FileMaker 12-14. Can be used as a hapi plugin"

Downloads

7

Readme

hapi-fm-rest

A Hapi Plugin that creates a RESTFul proxy to a FileMaker Server. You can use this to create a REST Wrapper for FileMaker Servers XML Gateway.

Usage

Installation

npm install hapi-fm-rest

This is a Hapi plugin. You use it like any other Hapi plugin. You register it with a Hapi server. It should play nicely with the Hapi ecosystem. The plugin takes two options.

options: {
    fmsAddress : <FMS_SERVER_ADDRESS>,
    idField : <the name of the primary key>
}

these default to localhost, and 'id' respectively.

Here is a complete Hapi Server that mounts the REST API at '/' on port 3000.

'use strict';

const Hapi = require ('hapi');
const fmrest = require('hapi-fm-rest');

const server = new Hapi.Server();
server.connection({ port: 3000 });

//if FileMaker Server is on a different server change "localhost" to the url of the server
//Or pass it in as environment variable
const FMS_SERVER_ADDRESS = process.env.FMS_SERVER_ADDRESS ? process.env.FMS_SERVER_ADDRESS : 'locahost';


// we need to the know name of the primary key in the database
// currently we only support one name, so all primary keys need to be have the same name.
const ID_FIELD = 'id';


server.register({
        register: fmrest,
        options: {
            fmsAddress : FMS_SERVER_ADDRESS,
            idField : ID_FIELD
        }
    },
    ()=>{
        server.start(() => {
            console.log('FM REST SERVER running at:', server.info.uri);
            console.log('FMServer is at', FMS_SERVER_ADDRESS );
        })
    }
);

Status

Alpha, the routes and data format may change.

Authentication

The plugin protects routes with basic authentication, which is passed on to the FileMaker Server for authentication

Data Format

JSON of course

Supported mime-types for sending data are the same as for standard hapi servers

  • application/json
  • application/x-www-form-urlencoded
  • application/octet-stream
  • text/*
  • multipart/form-data

Routes

The plugin mounts a set of RESTful routes for accessing FileMaker databases. All FileMaker Server XML Gateway query parameters are supported. -max, -sort, -script etc. See FileMaker Custom Web Publishing with XML for more information.

GET /dbanames

returns all the Databases available to the user.

GET /{db}/layoutnames

Returns all layouts for the given db

GET /{db}/scriptnames

Returns all scripts for the given db

GET /{db}/{layout}

Performs a search on the given layout in the given DB.

POST /{db}/{layout}

Creates a record on the given layout in the given DB.

GET /{db}/{layout}/{id}

Gets a record by it's primary key.

PATCH /{db}/{layout}/{id}

Updates the specified record

PUT /{db}/{layout}/{id}

Updates the specified record. The same as PATCH.

DELETE /{db}/{layout}/{id}

deletes the specified record.