Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
Enable code completion for Express (#9)
Browse files Browse the repository at this point in the history
* Enable code completion for Express

* Remove duplicate line
  • Loading branch information
seabaylea authored and neeraj-laad committed Jun 25, 2019
1 parent 7bbe683 commit d7b132f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions incubator/nodejs-express/image/project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"dependencies": {
"@cloudnative/health-connect": "^2.0.0",
"appmetrics-prometheus": "^2.0.0",
"vhost": "^3.0.2",
"express": "~4.16.0"
},
"devDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions incubator/nodejs-express/image/project/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const express = require('express');
const vhost = require('vhost');
const health = require('@cloudnative/health-connect');
const fs = require('fs');

Expand All @@ -18,13 +19,14 @@ function getEntryPoint() {
return package.main;
}

require(basePath + getEntryPoint())(app);

const healthcheck = new health.HealthChecker();
app.use('/live', health.LivenessEndpoint(healthcheck));
app.use('/ready', health.ReadinessEndpoint(healthcheck));
app.use('/health', health.HealthEndpoint(healthcheck));

const userApp = require(basePath + getEntryPoint()).app;
app.use(vhost('*', userApp));

app.get('*', (req, res) => {
res.status(404).send("Not Found");
});
Expand Down
12 changes: 6 additions & 6 deletions incubator/nodejs-express/templates/simple/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = (app) => {
const app = require('express')()

app.get('/', (req, res) => {
res.send("Hello World!");
});
}
app.get('/', (req, res) => {
res.send("Hello World!");
});

module.exports.app = app;
12 changes: 6 additions & 6 deletions incubator/nodejs-express/templates/skaffold/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = (app) => {
const app = require('express')()

app.set('views', __dirname + "/views");
app.set('view engine', 'pug');
app.set('views', __dirname + "/views");
app.set('view engine', 'pug');

app.use('/', require('./routes'));
}
app.use('/', require('./routes'));

module.exports.app = app;

0 comments on commit d7b132f

Please sign in to comment.