fire-web

0.1.0 • Public • Published

fire-web

Build Status

RESTful API and Web Development Expressions for fire.js and express.js

How to use

Install fire.js globally and run the following JSON file.

// app.fjson
{
	"name": "app",
	"json": {
		"@Web.Server.Boot": null
	}
}

$ fire app.fjson

This will initialize a fire.js Runtime and run a express.js server in port 3500(for both development and test environments). If you want it to run in port 80(production) you need to run it as superuser and set the environment variable NODE_ENV=production.

Web Expressions

Web Expressions are regular fire.js expressions especially decorated to be invoked using HTTP. To publish your fire.js expression as web expressions you just need to add a route attribute:

Example:

{
	"Web.Endpoint": "GET /hello",
	"name": "basicService.hello",
	"json": "Hello World"
}

If some http client invokes /hello it will get the following response:

{"response": "Hello World"}

Protocols

Protocols defines the shape of the API responses, by default Web.Protocols.Response is used.

The protocol can be changed globally if you set defaultResponseProtocol in the configurations.

Example:

{
	"modules": ["fire-web"],
	"environments": {
		"development": {
			"fire-web": {
				"port": 3503,
				"defaultResponseProtocol": "customProtocols.CustomProtocol"
			}
		}
	}
}

Some operation may require a custom protocol, using the responseProtocol attribute each expression can define it's own custom protocol.

Example:

{
	"Web.Endpoint": "GET /hello",
	"Web.Response.Protocol": "customProtocols.CustomOverride",
	"name": "useOverride.hello",
	"json": "Hello World"
}

Contributors

Cloning the Repository

git clone https://github.com/firejs/fire-web.git

Tests

make run-tests

MIT License

Copyright (c) 2011 Firebase.co and Contributors - http://www.firebase.co

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i fire-web

Weekly Downloads

1

Version

0.1.0

License

none

Last publish

Collaborators

  • firebaseco