diff --git a/README.md b/README.md index 7c4e5324..30e716f1 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,16 @@ -DADI Web +DADI Web [![npm (scoped)](https://img.shields.io/npm/v/@dadi/web.svg?maxAge=10800&style=flat-square)](https://www.npmjs.com/package/@dadi/web) -[![coverage](https://img.shields.io/badge/coverage-68%25-yellow.svg?style=flat?style=flat-square)](https://github.com/dadi/web) +[![coverage](https://img.shields.io/badge/coverage-61%25-yellow.svg?style=flat-square)](https://github.com/dadi/web) [![Build Status](https://travis-ci.org/dadi/web.svg?branch=master)](https://travis-ci.org/dadi/web) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/) -[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) + +## DADI Web + +* [Overview](#overview) +* [Requirements](#requirements) +* [Getting started](#getting-started) +* [Links](#links) ## Overview @@ -16,39 +22,102 @@ DADI Web uses LinkedIn's Dust templating language which provides a simple yet po DADI Web is part of [DADI](https://github.com/dadi/), a suite of components covering the full development stack, built for performance and scale. -## Getting Started +## Requirements + +* Node.js versions: + * 4.7.0 + * 5.12.0 + * 6.9.2 + +## Getting started + +### Initialise the project + +Running `npm init` adds a file called `package.json` to your project, allowing you to easily add dependencies to it: + +```bash +$ npm init +``` + +### Install the module from NPM + +All DADI platform microservices are available from [NPM](https://www.npmjs.com/). To add *Web* to your project as a dependency: + +```bash +$ npm install --save @dadi/web +``` + +### Add an entry point + +You'll need an entry point for your project. We'll create a file called `index.js` and later we will start the application with `node index.js`. -### Install via NPM +Add the following to the new file: -```shell -npm install @dadi/web +```js +/** + * index.js + */ +var app = require('@dadi/web') ``` -### Install via DADI Generator +### Configuration +Web requires a configuration file specific to the application environment. For example in the production environment it will look for a file named `config.production.json`. + +Place configuration files in a `config` folder in your application root, for example `config/config.development.json`. Full configuration documentation can be found at http://docs.dadi.tech/web/getting-started/configuration/. + +**Sample configuration** + +```json +{ + "server": { + "host": "localhost", + "port": 3000 + }, + "api": { + "host": "localhost", + "port": 3001 + } +} +``` + +### Start the server + +Web can be started from the command line simply by issuing the following command: + +```bash +node index.js ``` -npm install -g @dadi/generator -dadi-generator web /path/to/your_new_app -cd /path/to/your_new_app -npm install -npm start + +With the configuration above, our Web server is available at http://localhost:3000. + +#### Run Web as a service + +To run your Web application in the background as a service, install Forever and Forever Service: + +```bash +$ npm install forever forever-service -g + +$ forever-service install -s index.js -e NODE_ENV=production web --start ``` -## Documentation +> Note: the environment variable `NODE_ENV=production` must be set to required the configuration version matching the configuration files available in the `config` directory. + -Documentation can be found at the [DADI Docs site](http://docs.dadi.tech/web/). +## Links +* [Web Documentation](http://docs.dadi.tech/web/) ## Licence DADI is a data centric development and delivery stack, built specifically in support of the principles of API first and COPE. -Copyright notice -(C) 2016 DADI+ Limited +Copyright notice
+(C) 2017 DADI+ Limited
All rights reserved This product is part of DADI.
DADI is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by +it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version ("the GPL"). @@ -64,12 +133,11 @@ them, to determine what licences are applicable.** DADI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. +GNU General Public License for more details. -The GNU Affero General Public License (GPL) is available at +The GNU General Public License (GPL) is available at http://www.gnu.org/licenses/gpl-3.0.en.html.
A copy can be found in the file GPL.md distributed with these files. This copyright notice MUST APPEAR in all copies of the product! - diff --git a/package.json b/package.json index 31e2519c..3bacc174 100644 --- a/package.json +++ b/package.json @@ -80,8 +80,8 @@ "nock": "^7.7.2", "nodeunit": ">=0.5.1", "proxyquire": "1.7.3", - "should": "latest", - "sinon": "latest", + "should": "11.2.x", + "sinon": "1.17.7", "standard": "8.x.x", "superagent": "^1.8.0-beta.2", "superagent-mock": "^1.10.0",