Code Monkey home page Code Monkey logo

node-restify-boilerplate's Introduction

restify Boilerplate

Dependency Status Build Status Code Climate

Get your restify API up and running in no time :) Most of the things the boilerplate does should be self-explaining. If not: AMA

I included a custom authorization plugin, which is enabled by default. Feel free to modify its settings inside config/global.json

Index

CORS

Making CORS work properly if you use custom headers is not always straightforward (restify / Issue #284). The boilerplate provides a helper, which takes care of MethodNotAllowed responses in conjunction with preflight requests + custom headers.

Authorization (v1.1.0)

Enable via config.Security.UseAuth

Every request you make must be authenticated. The REST API uses a custom HTTP scheme based on a keyed-HMAC (Hash Message Authentication Code) for authentication.

The value of the Authorization header is as follows:

Authorization: <Config/Security/Scheme> <AccessKey>:<Signature(Base64(HMAC-SHA1(UTF-8(<String to Sign>), UTF-8(<SecretAccessKey>))))>

AccessKey: Provided by config/global.json SecretAccessKey: Provided by config/global.json String to Sign: Value of the <Config/Security/StringToSign> header

You can find an example in the examples/client branch.

ACL (v1.1.0)

Enable via config.Security.UseACL

The Boilerplate now supports ACL via node_acl. Take a look at config/global.json for configuration ...

Logging

By default node-bunyan is used for logging to a file (./logs/{{NODE_ENV}}-{{SERVER:NAME}}.log). Additionally sending logs to Loggly is supported (take a look at the config file).

Environments

NODE_ENV is not yet used to allow different configurations for development / production. The only thing it does is disabling the Auth- and CORS-Plugin in development.

$ NODE_ENV=production node server

vs.

$node server

node-restify-boilerplate's People

Contributors

a-magdy avatar dominiklessel avatar josephfinlayson avatar kamoljan avatar rot26 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-restify-boilerplate's Issues

BlanketJS Intergration

Hi,

Tried adding blanket with below configuration. It does not seem to be working.

"config": { "blanket": { "pattern": [ "" ], "data-cover-never": [ "node_modules" , "tests"] } }

Added below line in the Makefile

@NODE_ENV=test ./node_modules/.bin/mocha --require blanket -R html-cov > coverage.html

Coverage.html gets created. But it shows 0% coverage 0 SLOC

@ravilution

Question about "createServer" in server.js

Hello,

I have to admit that I am an absolute beginner NodeJS wise... That said, here my question:

In 'restify.createServer(...)' you are setting an option named "acceptable". This is not one of the configuration options listed on the restify API Docs pages. After googeling around for quite while I am still puzzled. What is that option good for? Am I missing something? Looking at it's value I can assume what it is ment to configure, but I can not find any documentation about the restify aspect of this setting. Please help out and explain.

Thanks in advance,
Andreas Flügge

Example using Authorization?

The boilerplate you've set up is pretty cool. Everything seems to be working for me except for the authorization. I'm new to developing REST APIs and I was wondering if you could point me to an example of this in use?

I'm trying to test it and can't seem get the authorization header right, and even if I could I don't know how to generate the value(s) to put in the authorization header.

A bit of an explanation on how to use it, maybe an example, would be extremely helpful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.