Address comments

This commit is contained in:
Fredrik Adelöw
2020-04-22 17:25:24 +02:00
parent 83689b6236
commit c2b5647036
5 changed files with 9 additions and 44 deletions
+1 -1
View File
@@ -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()'
},
};
+3 -5
View File
@@ -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",
+2 -28
View File
@@ -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}`);
});
+2 -2
View File
@@ -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');