forked from Polymer/prpl-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trivial skeleton for TypeScript Express server project. (Polymer#1)
- Loading branch information
Showing
11 changed files
with
1,644 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
BasedOnStyle: Google | ||
AlignAfterOpenBracket: AlwaysBreak | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
BinPackArguments: false | ||
BinPackParameters: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
language: node_js | ||
node_js: | ||
- "6" | ||
- "node" | ||
script: | ||
- npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,41 @@ | ||
[![Build Status](https://travis-ci.org/Polymer/prpl-server-node.svg?branch=master)](https://travis-ci.org/Polymer/prpl-server-node) | ||
|
||
# prpl-server-node | ||
|
||
A Node implementation of the [PRPL](https://developers.google.com/web/fundamentals/performance/prpl-pattern/) pattern for serving Progressive Web Apps. | ||
|
||
## Installation | ||
|
||
```sh | ||
$ yarn install prpl-server -g | ||
``` | ||
|
||
## Usage | ||
|
||
### From the command line | ||
|
||
```sh | ||
$ cd my-project/ | ||
$ prpl-server | ||
``` | ||
|
||
### As a library | ||
|
||
```js | ||
const server = require('prpl-server').server() | ||
server.listen(8080); | ||
``` | ||
|
||
## Compiling from source | ||
|
||
```sh | ||
$ yarn run build # once | ||
$ yarn run build:test # continuous | ||
``` | ||
|
||
## Run tests | ||
|
||
```sh | ||
$ yarn run test # once | ||
$ yarn run test:watch # continuous | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
require('../lib/cli.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,34 @@ | ||
{ | ||
"name": "prpl-server-node", | ||
"name": "prpl-server", | ||
"version": "0.1.0", | ||
"description": "A Node implementation of the PRPL pattern for serving Progressive Web Apps", | ||
"repository": "git+https://github.com/Polymer/prpl-server-node.git", | ||
"main": "lib/server.js", | ||
"bin": "bin/prpl-server", | ||
"engines": { | ||
"node": ">=6.0" | ||
}, | ||
"author": "The Polymer Project Authors", | ||
"license": "BSD-3-Clause" | ||
"license": "BSD-3-Clause", | ||
"scripts": { | ||
"build": "tsc", | ||
"build:watch": "tsc --watch", | ||
"format": "find src -name '*.ts' | xargs clang-format --style=file -i", | ||
"test": "npm run build && mocha", | ||
"test:watch": "watchy -w src -- npm run test" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^3.5.2", | ||
"@types/mocha": "^2.2.41", | ||
"chai": "^3.5.0", | ||
"clang-format": "^1.0.50", | ||
"mocha": "^3.3.0", | ||
"source-map-support": "^0.4.15", | ||
"typescript": "^2.3.2", | ||
"watchy": "^0.6.7" | ||
}, | ||
"dependencies": { | ||
"@types/express": "^4.0.35", | ||
"express": "^4.15.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at | ||
* http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at | ||
* http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at | ||
* http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at | ||
* http://polymer.github.io/PATENTS.txt | ||
*/ | ||
|
||
import {server} from './server'; | ||
|
||
server().listen(8080); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at | ||
* http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at | ||
* http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at | ||
* http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at | ||
* http://polymer.github.io/PATENTS.txt | ||
*/ | ||
|
||
import * as express from 'express'; | ||
|
||
export function server(): express.Express { | ||
const app = express(); | ||
app.get('*', function(_req, res, _next) { | ||
res.send('hello world'); | ||
}); | ||
return app; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at | ||
* http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at | ||
* http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at | ||
* http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at | ||
* http://polymer.github.io/PATENTS.txt | ||
*/ | ||
|
||
import {assert} from 'chai'; | ||
import {server} from '../server'; | ||
|
||
suite('prpl server', function() { | ||
test('is created', () => { | ||
const app = server(); | ||
assert.isOk(app); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--ui tdd | ||
--require source-map-support/register | ||
lib/test/**/*_test.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6", | ||
"lib": [ | ||
"es2016" | ||
], | ||
"outDir": "lib", | ||
"module": "commonjs", | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"preserveConstEnums": true, | ||
"sourceMap": true, | ||
"pretty": true, | ||
"declaration": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": [ | ||
"src/**/*.ts" | ||
] | ||
} |
Oops, something went wrong.