Skip to content

Commit

Permalink
refactor: examples, specifies port,host and OpenAPI server
Browse files Browse the repository at this point in the history
  • Loading branch information
marioestradarosa committed Oct 26, 2018
1 parent 4283a98 commit 2e7d4bb
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
12 changes: 11 additions & 1 deletion examples/hello-world/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ module.exports = application;

if (require.main === module) {
// Run the application
application.main().catch(err => {
const config = {
rest: {
port: +process.env.PORT || 3000,
host: process.env.HOST || 'localhost',
openApiSpec: {
// useful when used with OASGraph to locate your application
setServersFromRequest: true,
},
},
};
application.main(config).catch(err => {
console.error('Cannot start the application.', err);
process.exit(1);
});
Expand Down
12 changes: 11 additions & 1 deletion examples/soap-calculator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ module.exports = application;

if (require.main === module) {
// Run the application
application.main().catch(err => {
const config = {
rest: {
port: +process.env.PORT || 3000,
host: process.env.HOST || 'localhost',
openApiSpec: {
// useful when used with OASGraph to locate your application
setServersFromRequest: true,
},
},
};
application.main(config).catch(err => {
console.error('Cannot start the application.', err);
process.exit(1);
});
Expand Down
10 changes: 10 additions & 0 deletions examples/todo-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ module.exports = application;

if (require.main === module) {
// Run the application
const config = {
rest: {
port: +process.env.PORT || 3000,
host: process.env.HOST || 'localhost',
openApiSpec: {
// useful when used with OASGraph to locate your application
setServersFromRequest: true,
},
},
};
application.main().catch(err => {
console.error('Cannot start the application.', err);
process.exit(1);
Expand Down
12 changes: 11 additions & 1 deletion examples/todo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ module.exports = application;

if (require.main === module) {
// Run the application
application.main().catch(err => {
const config = {
rest: {
port: +process.env.PORT || 3000,
host: process.env.HOST || 'localhost',
openApiSpec: {
// useful when used with OASGraph to locate your application
setServersFromRequest: true,
},
},
};
application.main(config).catch(err => {
console.error('Cannot start the application.', err);
process.exit(1);
});
Expand Down

0 comments on commit 2e7d4bb

Please sign in to comment.