Skip to content

Commit

Permalink
Starter package with HTML and CSS, and minimal JS
Browse files Browse the repository at this point in the history
  • Loading branch information
André Carvalho committed Nov 20, 2017
0 parents commit 2c9e3e4
Show file tree
Hide file tree
Showing 15 changed files with 3,161 additions and 0 deletions.
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
9 changes: 9 additions & 0 deletions .cfignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.env
.env.template

.eslintrc
.gitignore
.prettierrc
jsconfig.json

node_modules
12 changes: 12 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Rename to ".env" and add or change what you need.

# The app will listen on this port.
PORT=3000

# These variables will be used to configure our application, so it can talk to Watson.
WATSON_CONVERSATION_USERNAME=
WATSON_CONVERSATION_PASSWORD=
WATSON_CONVERSATION_WORKSPACE_ID=

# When running on Bluemix, this will identify the name of the service.
WATSON_CONVERSATION_SERVICE_NAME=
14 changes: 14 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"plugins": ["prettier"],
"parser": "babel-eslint",
"rules": {
"prettier/prettier": "off"
},
"extends": ["prettier"],
"env": {
"es6": true
},
"parserOptions": {
"ecmaVersion": 7
}
}
139 changes: 139 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@

# Created by https://www.gitignore.io/api/osx,node,linux,windows,visualstudiocode

### VCAP ###
vcap-local.json

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env


### OSX ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/osx,node,linux,windows,visualstudiocode
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"bracketSpacing": true,
"jsxBracketSameLine": false,
"printWidth": 80,
"semi": true,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "none",
"useTabs": false
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Watson Demo Starter

Starter package, with no code.

## Running this

- Clone this repository to a folder.
- On a terminal, navigate to the cloned folder and run `npm install`.
- Open the folder in your favourite text editor.

## Configuring Watson SDK

For safety reasons, the Watson SDK is configured using environment variables.

A file called `.env.template` is next to this one. Copy it, and rename it to `.env`.

Then, add the values you need.
32 changes: 32 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use strict";

// Config
const dotenv = require("dotenv");

// @ts-ignore
dotenv.config({ silent: true });

const cfenv = require("cfenv");

// @ts-ignore
const appEnv = cfenv.getAppEnv();

const services = appEnv.getServices();

const path = require("path");

const express = require("express");
const bodyParser = require("body-parser");

// TODO Configure Watson...

const app = express();

app.use(express.static(path.join(__dirname, "public")));
app.use(bodyParser.json());

// TODO Make our app do things...

const port = process.env.PORT || process.env.VCAP_APP_PORT || 3000;

app.listen(port, () => console.log("Server listening on", port));
8 changes: 8 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es6",
"lib": ["es2015", "dom"],
"module": "commonjs",
"checkJs": true
}
}
Loading

0 comments on commit 2c9e3e4

Please sign in to comment.