Skip to content
This repository has been archived by the owner on Feb 28, 2020. It is now read-only.

Commit

Permalink
Merge 9d12902 into 86a102f
Browse files Browse the repository at this point in the history
  • Loading branch information
BethGriggs committed Nov 14, 2018
2 parents 86a102f + 9d12902 commit f746d45
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 32 deletions.
5 changes: 2 additions & 3 deletions app/templates/fromswagger/routers/router.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var express = require('express');
const express = require('express');

module.exports = function(app, basepath) {
var router = express.Router();
const router = express.Router();

{{#if routes}}
{{#each routes}}
Expand All @@ -18,4 +18,3 @@ module.exports = function(app, basepath) {
{{/if}}
}

2 changes: 1 addition & 1 deletion app/templates/public/swagger-ui/o2c.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
var qp = null;
let qp = null;
if(/code|token|error/.test(window.location.hash)) {
qp = location.hash.substring(1);
}
Expand Down
7 changes: 2 additions & 5 deletions app/templates/server/routers/health.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
var express = require('express');
const express = require('express');

module.exports = function(app) {
var router = express.Router();
const router = express.Router();

router.get('/', function (req, res, next) {
res.json({status: 'UP'});
});

app.use("/health", router);
}



4 changes: 2 additions & 2 deletions app/templates/server/routers/public.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var express = require('express');
const express = require('express');

module.exports = function(app){
var router = express.Router();
const router = express.Router();
router.use(express.static(process.cwd() + '/public'));
app.use(router);
}
6 changes: 3 additions & 3 deletions app/templates/server/routers/swagger.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var express = require('express');
const express = require('express');

module.exports = function(app){
var router = express.Router();
const router = express.Router();
app.use("/swagger/api", express.static("./public/swagger.{{openApiFileType}}"));
app.use("/explorer", express.static("./public/swagger-ui"));
app.use(router);
}
}
4 changes: 2 additions & 2 deletions app/templates/server/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Uncomment following to enable zipkin tracing, tailor to fit your network configuration:
// var appzip = require('appmetrics-zipkin')({
// const appzip = require('appmetrics-zipkin')({
// host: 'localhost',
// port: 9411,
// serviceName:'frontend'
Expand Down Expand Up @@ -44,4 +44,4 @@ app.use(function (err, req, res, next) {
res.sendFile(path.join(__dirname, '../public', '500.html'));
});

module.exports = server;
module.exports = server;
12 changes: 5 additions & 7 deletions app/templates/test/resource.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var expect = require('chai').expect;
var http = require('http');
const expect = require('chai').expect;
const http = require('http');

before(function(done){
require(process.cwd() + '/server/server');
Expand All @@ -12,23 +12,22 @@ before(function(done){
{{#testing route method ../basepath}}
{{/testing}}
it('Testing GET for {{route}} route',function(done){
var responseString = '';
let responseString = '';

var options = {
const options = {
host: 'localhost',
port: process.env.PORT || 3000,
{{#path route ../basepath}}{{/path}}
};

var callback = function(response){
const callback = function(response){
response.on('data', function (chunk) {
responseString += chunk;
});

response.on('end', function () {
expect(responseString).to.equal('{}');
done();

});
};

Expand All @@ -37,4 +36,3 @@ before(function(done){
});
{{/each}}
{{/if}}

8 changes: 4 additions & 4 deletions app/templates/test/test-demo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var assert = require('chai').assert;
var expect = require('chai').expect;
var should = require('chai').should();
const assert = require('chai').assert;
const expect = require('chai').expect;
const should = require('chai').should();

// Below code demonstrates using various methods of testing
describe('Demonstrating testing with various assertion methods', function() {
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('Demonstrating testing with various assertion methods', function() {
"asd".should.have.lengthOf(3);
});
it('Tests property existence and length using should', function() {
var obj = {
const obj = {
arr:[1,2,3]
};
obj.should.have.property("arr").with.lengthOf(3);
Expand Down
10 changes: 5 additions & 5 deletions app/templates/test/test-server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var expect = require('chai').expect;
var http = require('http');
const expect = require('chai').expect;
const http = require('http');

// Below code demonstrates using various methods of testing
describe('Testing Server', function() {
Expand All @@ -12,15 +12,15 @@ describe('Testing Server', function() {
});

it('Health endpoint shows status up', function(done){
var responseString = '';
let responseString = '';

var options = {
const options = {
host: 'localhost',
port: process.env.PORT || 3000,
path: '/health'
};

var callback = function(response){
const callback = function(response){
response.on('data', function (chunk) {
responseString += chunk;
});
Expand Down

0 comments on commit f746d45

Please sign in to comment.