Address comments
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
rules: {
|
||||
'no-console': 0, // Permitted in console programs
|
||||
'new-cap': 0, // Because Express constructs things e.g. like 'const r = express.Router()'
|
||||
'new-cap': ['error', { capIsNew: false }], // Because Express constructs things e.g. like 'const r = express.Router()'
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,29 +1,27 @@
|
||||
{
|
||||
"name": "@backstage/backend",
|
||||
"name": "example-backend",
|
||||
"version": "0.1.1-alpha.4",
|
||||
"main": "dist",
|
||||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=13"
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"start": "tsc-watch --onSuccess nodemon",
|
||||
"start": "tsc-watch --onFirstSuccess nodemon",
|
||||
"lint": "backstage-cli lint",
|
||||
"test": "backstage-cli test",
|
||||
"clean": "backstage-cli clean"
|
||||
},
|
||||
"dependencies": {
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"helmet": "^3.22.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.1.1-alpha.4",
|
||||
"@types/cors": "^2.8.6",
|
||||
"@types/dotenv": "^8.2.0",
|
||||
"@types/express": "^4.17.6",
|
||||
"@types/express-serve-static-core": "^4.17.5",
|
||||
"@types/helmet": "^0.0.45",
|
||||
|
||||
@@ -14,45 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Required External Modules
|
||||
*/
|
||||
|
||||
import * as dotenv from 'dotenv';
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import helmet from 'helmet';
|
||||
import { testRouter } from './test';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
/**
|
||||
* App Variables
|
||||
*/
|
||||
|
||||
if (!process.env.PORT) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const PORT: number = parseInt(process.env.PORT as string, 10);
|
||||
|
||||
const PORT = 7000;
|
||||
const app = express();
|
||||
|
||||
/**
|
||||
* App Configuration
|
||||
*/
|
||||
|
||||
app.use(helmet());
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
import { testRouter } from './test';
|
||||
|
||||
app.use('/test', testRouter);
|
||||
|
||||
/**
|
||||
* Server Activation
|
||||
*/
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Listening on port ${PORT}`);
|
||||
});
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import express from 'express';
|
||||
import { Router } from 'express';
|
||||
|
||||
export const testRouter = express.Router();
|
||||
export const testRouter = Router();
|
||||
|
||||
testRouter.get('/', async (_, res) => {
|
||||
res.status(200).send('hello');
|
||||
|
||||
@@ -3649,13 +3649,6 @@
|
||||
resolved "https://registry.npmjs.org/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd"
|
||||
integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==
|
||||
|
||||
"@types/dotenv@^8.2.0":
|
||||
version "8.2.0"
|
||||
resolved "https://registry.npmjs.org/@types/dotenv/-/dotenv-8.2.0.tgz#5cd64710c3c98e82d9d15844375a33bf1b45d053"
|
||||
integrity sha512-ylSC9GhfRH7m1EUXBXofhgx4lUWmFeQDINW5oLuS+gxWdfUeW4zJdeVTYVkexEW+e2VUvlZR2kGnGGipAWR7kw==
|
||||
dependencies:
|
||||
dotenv "*"
|
||||
|
||||
"@types/eslint-visitor-keys@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d"
|
||||
@@ -7908,7 +7901,7 @@ dotenv-webpack@^1.7.0:
|
||||
dependencies:
|
||||
dotenv-defaults "^1.0.2"
|
||||
|
||||
dotenv@*, dotenv@8.2.0, dotenv@^8.0.0, dotenv@^8.2.0:
|
||||
dotenv@8.2.0, dotenv@^8.0.0:
|
||||
version "8.2.0"
|
||||
resolved "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
|
||||
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==
|
||||
|
||||
Reference in New Issue
Block a user