@nzz/q-cli 1.5.4 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.vscode/settings.json +5 -0
  2. package/README.md +16 -1
  3. package/bin/commands/bootstrap.js +6 -0
  4. package/dev-server/routes/rendering-info.js +0 -1
  5. package/dev-server/routes/tool-default.js +0 -2
  6. package/dev-server/server.js +3 -0
  7. package/package.json +1 -1
  8. package/skeletons/custom-code-skeleton/.nvmrc +1 -1
  9. package/skeletons/custom-code-skeleton/.vscode/settings.json +5 -0
  10. package/skeletons/custom-code-skeleton/README.md +17 -6
  11. package/skeletons/custom-code-skeleton/index.d.ts +3 -0
  12. package/skeletons/custom-code-skeleton/package-lock.json +5563 -791
  13. package/skeletons/custom-code-skeleton/package.json +22 -12
  14. package/skeletons/custom-code-skeleton/q.config.json +2 -2
  15. package/skeletons/custom-code-skeleton/rollup.config.js +116 -70
  16. package/skeletons/custom-code-skeleton/src/App.scss +5 -0
  17. package/skeletons/custom-code-skeleton/src/App.svelte +3 -7
  18. package/skeletons/custom-code-skeleton/src/interfaces.ts +0 -0
  19. package/skeletons/custom-code-skeleton/src/{main-prod.js → main-prod.ts} +1 -0
  20. package/skeletons/custom-code-skeleton/src/main.scss +1 -0
  21. package/skeletons/custom-code-skeleton/src/main.ts +18 -0
  22. package/skeletons/custom-code-skeleton/tsconfig.json +15 -0
  23. package/skeletons/server-skeleton/auth/routes.js +0 -9
  24. package/skeletons/server-skeleton/index.js +1 -3
  25. package/skeletons/tool-skeleton/.nvmrc +1 -1
  26. package/skeletons/tool-skeleton/.travis.yml +26 -0
  27. package/skeletons/tool-skeleton/.vscode/settings.json +5 -0
  28. package/skeletons/tool-skeleton/Dockerfile +1 -1
  29. package/skeletons/tool-skeleton/LICENSE +20 -0
  30. package/skeletons/tool-skeleton/README.md +1 -1
  31. package/skeletons/tool-skeleton/index.js +1 -6
  32. package/skeletons/tool-skeleton/package-lock.json +8540 -2741
  33. package/skeletons/tool-skeleton/package.json +24 -12
  34. package/skeletons/tool-skeleton/rollup.config.js +75 -0
  35. package/skeletons/tool-skeleton/routes/fixtures/data.js +1 -3
  36. package/skeletons/tool-skeleton/routes/rendering-info/web.js +43 -20
  37. package/skeletons/tool-skeleton/routes/routes.js +1 -1
  38. package/skeletons/tool-skeleton/routes/script.js +4 -5
  39. package/skeletons/tool-skeleton/routes/stylesheet.js +4 -5
  40. package/skeletons/tool-skeleton/sass.config.js +66 -0
  41. package/skeletons/tool-skeleton/scripts_src/default.js +3 -0
  42. package/skeletons/tool-skeleton/styles_src/_variables.scss +1 -0
  43. package/skeletons/tool-skeleton/styles_src/main.scss +2 -0
  44. package/skeletons/tool-skeleton/test/e2e-tests.js +4 -6
  45. package/skeletons/tool-skeleton/views/dynamic/YourTool.scss +5 -0
  46. package/skeletons/tool-skeleton/views/dynamic/YourTool.svelte +19 -0
  47. package/skeletons/tool-skeleton/views/static/App.scss +5 -0
  48. package/skeletons/tool-skeleton/views/static/App.svelte +21 -0
  49. package/skeletons/tool-skeleton/views/static/components/Footer.svelte +31 -0
  50. package/skeletons/tool-skeleton/views/static/components/Header.svelte +7 -0
  51. package/skeletons/custom-code-skeleton/src/main.js +0 -10
  52. package/skeletons/tool-skeleton/styles_src/default.scss +0 -4
  53. package/skeletons/tool-skeleton/tasks/build.js +0 -98
@@ -2,21 +2,29 @@
2
2
  "name": "custom-code-skeleton",
3
3
  "version": "1.0.0",
4
4
  "devDependencies": {
5
+ "@nzz/nzz.ch-static": "github:nzzdev/nzz.ch-static#v1.0.0",
5
6
  "@nzz/q-cli": "^1.4.11",
6
- "@rollup/plugin-buble": "^0.21.3",
7
- "@rollup/plugin-commonjs": "^17.1.0",
8
- "@rollup/plugin-html": "^0.2.3",
7
+ "@rollup/plugin-alias": "^3.1.9",
8
+ "@rollup/plugin-commonjs": "^21.0.0",
9
+ "@rollup/plugin-html": "^0.2.4",
10
+ "@rollup/plugin-image": "^2.1.1",
9
11
  "@rollup/plugin-json": "^4.1.0",
10
- "@rollup/plugin-node-resolve": "^11.2.1",
12
+ "@rollup/plugin-node-resolve": "^13.0.5",
13
+ "@rollup/plugin-typescript": "^8.3.2",
14
+ "@tsconfig/svelte": "^3.0.0",
15
+ "autoprefixer": "^10.4.0",
16
+ "cssnano": "^5.0.10",
11
17
  "npm-run-all": "^4.1.5",
18
+ "postcss": "^8.3.11",
12
19
  "rollup": "^2.50.1",
13
- "rollup-plugin-css-only": "^3.1.0",
14
- "rollup-plugin-livereload": "^2.0.0",
20
+ "rollup-plugin-livereload": "^2.0.5",
21
+ "rollup-plugin-scss": "^3.0.0",
15
22
  "rollup-plugin-svelte": "^7.1.0",
16
- "rollup-plugin-svg": "^2.0.0",
17
23
  "rollup-plugin-terser": "^7.0.2",
24
+ "sass": "^1.43.4",
18
25
  "sirv-cli": "^1.0.12",
19
- "svelte": "^3.38.2"
26
+ "svelte": "^3.43.1",
27
+ "typescript": "^4.6.4"
20
28
  },
21
29
  "scripts": {
22
30
  "update-all": "npm run build && Q update-item",
@@ -24,9 +32,11 @@
24
32
  "update-staging": "npm run build && Q update-item -e staging",
25
33
  "update-test": "npm run build && Q update-item -e test",
26
34
  "build": "rollup -c",
27
- "autobuild": "rollup -c -w",
28
- "dev": "run-p start:dev autobuild",
29
- "start": "sirv public",
30
- "start:dev": "sirv public --dev"
35
+ "start": "npm run start-regular",
36
+ "start-regular": "LAYOUT=regular run-p serve rollup",
37
+ "start-ls": "LAYOUT=longform-standard run-p serve rollup",
38
+ "start-lv": "LAYOUT=longform-visual run-p serve rollup",
39
+ "rollup": "rollup -c -w",
40
+ "serve": "sirv public --dev --port 5555 --host 0.0.0.0"
31
41
  }
32
42
  }
@@ -4,11 +4,11 @@
4
4
  "environments": [
5
5
  {
6
6
  "name": "staging",
7
- "id": ""
7
+ "id": "staging-id-not-set"
8
8
  },
9
9
  {
10
10
  "name": "production",
11
- "id": ""
11
+ "id": "prod-id-not-set"
12
12
  }
13
13
  ],
14
14
  "item": {
@@ -1,17 +1,28 @@
1
- import resolve from "@rollup/plugin-node-resolve";
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ import nodeResolve from "@rollup/plugin-node-resolve";
2
4
  import commonjs from "@rollup/plugin-commonjs";
3
- import buble from "@rollup/plugin-buble";
4
5
  import json from "@rollup/plugin-json";
5
- import svg from "rollup-plugin-svg";
6
6
  import html from "@rollup/plugin-html";
7
7
  import svelte from "rollup-plugin-svelte";
8
8
  import { terser } from "rollup-plugin-terser";
9
- import css from "rollup-plugin-css-only";
10
9
  import livereload from "rollup-plugin-livereload";
11
- import packageConfig from "./package.json";
10
+ import scss from "rollup-plugin-scss";
11
+ import postcss from "postcss";
12
+ import cssnano from "cssnano";
13
+ import autoprefixer from "autoprefixer";
12
14
  import qConfig from "./q.config.json";
15
+ import typescript from '@rollup/plugin-typescript';
16
+ import image from '@rollup/plugin-image';
17
+ import alias from '@rollup/plugin-alias';
18
+ import { createContentWidthQElement, createFullwidthQElement, getHtml, createSubtitle, createParagraph } from '@nzz/nzz.ch-static';
19
+
20
+ // Which nzz layout to use?
21
+ const LAYOUT = process.env.LAYOUT;
22
+ const builtCssFilename = 'bundle';
13
23
 
14
24
  const production = !process.env.ROLLUP_WATCH;
25
+ const projectRootDir = path.resolve(__dirname);
15
26
 
16
27
  function getOutputConfigs() {
17
28
  const outputConfigs = [];
@@ -31,82 +42,126 @@ function getOutputConfigs() {
31
42
  return outputConfigs;
32
43
  }
33
44
 
34
- function getTemplate(options) {
35
- return `<!DOCTYPE html>
36
- <html lang="de">
37
- <head>
38
- <meta charset="utf-8">
39
- <meta name="viewport" content="width=device-width">
40
- <title>${packageConfig.name}</title>
41
- <link rel="stylesheet" href="https://context-service.st.nzz.ch/stylesheet/all/nzz.ch.css" />
42
- <link rel="stylesheet" href="https://service.sophie.nzz.ch/bundle/sophie-q@^1,sophie-input@^1,sophie-font@^1,sophie-color@^1,sophie-viz-color@^1,sophie-legend@^1.css" />
43
- <link rel="stylesheet" href="bundle.css" />
44
- </head>
45
- <!-- we have four different article templates, since the article itself has the same structure in each template
46
- we can use either of these classes: regular, longformstandard, regular, opinion
47
- if one changes the class attached to body tag one should change the class in section tag accordingly (maybe further adjustments needed too) -->
48
- <body class="regular">
49
- <div id="__nzz">
50
- <div id="__layout">
51
- <div class="page--article-id">
52
- <div class="pageholder">
53
- <div class="nzz-container">
54
- <div class="nzz-page-transition">
55
- <div class="article">
56
- <!-- also here change layout--{template} accordingly -->
57
- <section class="container container--article layout--regular">
58
- <!-- default = content width, for fullwidth, small left/right one has to add one of
59
- the following classes accordingly: widget--fullwidth, widget--left, widget--right-->
60
- <div class="articlecomponent q-embed widget--qembed regwalled">
61
- <div>
62
- <div class="s-q-item" id="container"></div>
63
- <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Map,URL,Promise,fetch,URLSearchParams,Array.prototype.find,Array.prototype.findIndex,Object.entries,Array.prototype.includes,CustomEvent,Array.from,String.prototype.startsWith&flags=gated&unknown=polyfill"></script>
64
- <script src="${options.files.js[0].fileName}"></script>
65
- </div>
66
- </div>
67
- </section>
68
- </div>
69
- </div>
70
- </div>
71
- </div>
72
- </div>
73
- </div>
74
- </div>
75
- </body>
76
- </html>`;
77
- }
78
-
79
45
  function getHtmlOptions() {
80
46
  return {
81
- fileName: "index.html",
82
- template: function (options) {
83
- return getTemplate(options);
84
- },
47
+ fileName: 'index.html',
48
+ template: function (options) {
49
+ return getHtml({
50
+ // These 3 options are the most important. Without them the static website will not function.
51
+ layout: LAYOUT, // Type of layout.
52
+ builtCssFilename, // Will be appended at the end of <head>.
53
+ builtJsFilename: options.files.js[0].fileName, // Will appended to the end of <body>.
54
+
55
+ // Create mock elements to simulate your article.
56
+ content: `
57
+ ${createSubtitle('Test Subtitle')}
58
+ ${createParagraph('Test paragraph')}
59
+ ${createFullwidthQElement('custom-code-fw')}
60
+ ${createContentWidthQElement('custom-code-cw')}
61
+ `,
62
+
63
+ // Other options.
64
+ author: 'Max Musterman',
65
+ lead: 'Test lead.',
66
+ title: 'Test title',
67
+
68
+ // Links to other css files that need to be loaded.
69
+ // Will be appended to <head> but before the bundled css file of your app.
70
+ customCssLinks: [
71
+ 'https://service.sophie.nzz.ch/bundle/sophie-q@^1,sophie-input@^1,sophie-font@^1,sophie-color@^1,sophie-viz-color@^1,sophie-legend@^1.css',
72
+ ],
73
+
74
+ // Links to other js filed that need to be loaded.
75
+ // Will be appended at the end of the body, but before the built js file for the app.
76
+ customJsLinks: [
77
+ 'https://cdn.polyfill.io/v2/polyfill.min.js?features=Map,URL,Promise,fetch,URLSearchParams,Array.prototype.find,Array.prototype.findIndex,Object.entries,Array.prototype.includes,CustomEvent,Array.from,String.prototype.startsWith&flags=gated&unknown=polyfill'
78
+ ],
79
+ });
80
+ },
85
81
  };
86
82
  }
87
83
 
84
+ function getPostcssPlugins(isProduction) {
85
+ const postcssPlugins = [autoprefixer];
86
+
87
+ if (isProduction) {
88
+ postcssPlugins.push(cssnano);
89
+ }
90
+
91
+ return postcssPlugins;
92
+ }
93
+
94
+ function createOutputCssFunction() {
95
+ const outputCssFunction = (styles, styleNodes) => {
96
+ const publicDir = "public";
97
+
98
+ if (!fs.existsSync(publicDir)) {
99
+ fs.mkdirSync(publicDir);
100
+ }
101
+
102
+ fs.writeFileSync(`${publicDir}/${builtCssFilename}.css`, styles);
103
+ };
104
+
105
+ return outputCssFunction;
106
+ }
107
+
108
+ function getSassConfig(isProduction) {
109
+ const config = {
110
+ outputStyle: isProduction ? "compressed" : "expanded",
111
+ // Sourcemap generation (specifically writing the file to system) is currently not supported by rollup-plugin-sass (but soon!)
112
+ // See: https://github.com/thgh/rollup-plugin-scss/issues/7
113
+ // outFile: path.join(__dirname, "/public/default.css"), // <- Uncomment after: https://github.com/thgh/rollup-plugin-scss/issues/7
114
+ sourceMap: !isProduction,
115
+ sourceMapEmbed: !isProduction, // Remove after: https://github.com/thgh/rollup-plugin-scss/issues/7
116
+ failOnError: !isProduction,
117
+ watch: [path.join(__dirname, "/src")],
118
+ processor: (css) =>
119
+ postcss(getPostcssPlugins(isProduction))
120
+ .process(css, {
121
+ from: path.join(__dirname, `/public/${builtCssFilename}.css`),
122
+ to: path.join(__dirname, `/public/${builtCssFilename}.css`),
123
+ map: isProduction ? false : { inline: true }, // Set to false after: https://github.com/thgh/rollup-plugin-scss/issues/7
124
+ })
125
+ .then((result) => result.css),
126
+ output: createOutputCssFunction(),
127
+ };
128
+
129
+ return config;
130
+ }
131
+
88
132
  export default {
89
- input: production ? "src/main-prod.js" : "src/main.js",
133
+ input: production ? "src/main-prod.ts" : "src/main.ts",
90
134
  output: getOutputConfigs(),
91
135
  plugins: [
136
+ alias({
137
+ entries: [
138
+ { find: '@src', replacement: path.resolve(projectRootDir, 'src') },
139
+ { find: '@interfaces', replacement: path.resolve(projectRootDir, 'src/interfaces.ts') },
140
+ ]
141
+ }),
142
+
143
+ typescript({ sourceMap: !production }),
92
144
  json(),
93
- svg({ base64: true }),
145
+ image(),
94
146
  svelte({
95
147
  compilerOptions: {
96
148
  // enable run-time checks when not in production
97
149
  dev: !production,
98
150
  },
99
151
  }),
100
- // we'll extract any component CSS out into
101
- // a separate file - better for performance
102
- css({ output: "bundle.css" }),
152
+
153
+ // All styles have to be written in .scss files (inside '/src')
154
+ // Sass files (except partials) have to be imported in main.scss file (Use '@use' instead of '@import')
155
+ // Partials are placed in '/src/styles' (e.g. _variables.scss, _helpers.scss)
156
+ // Partials are imported directly in other sass files (e.g. _variables.scss -> '@use "variables"')
157
+ scss({ ...getSassConfig(production) }),
103
158
 
104
159
  // If you have external dependencies installed from
105
160
  // npm, you'll most likely need these plugins. In
106
161
  // some cases you'll need additional configuration —
107
162
  // consult the documentation for details:
108
163
  // https://github.com/rollup/rollup-plugin-commonjs
109
- resolve({ browser: true }),
164
+ nodeResolve({ browser: true }),
110
165
  commonjs(),
111
166
 
112
167
  // Generate a index.html file when not building for production
@@ -114,16 +169,7 @@ export default {
114
169
 
115
170
  // Watch the `public` directory and refresh the
116
171
  // browser on changes when not in production
117
- !production && livereload("public"),
118
-
119
- // If we're building for production (npm run build
120
- // instead of npm run dev), transpile and minify
121
- production &&
122
- buble({
123
- transforms: {
124
- dangerousForOf: true,
125
- },
126
- }),
172
+ !production && livereload({ watch: ["public"], delay: 800 }),
127
173
  production && terser(),
128
174
  ],
129
175
  watch: {
@@ -0,0 +1,5 @@
1
+ .custom-code-item {
2
+ color: salmon;
3
+ border: 1px solid #000;
4
+ margin-bottom: 20px;
5
+ }
@@ -2,10 +2,6 @@
2
2
  export let name;
3
3
  </script>
4
4
 
5
- <style>
6
- .title {
7
- color: brown;
8
- }
9
- </style>
10
-
11
- <h1 class="title s-font-title">Custom Code {name}</h1>
5
+ <div class="custom-code-item">
6
+ Custom Code {name}
7
+ </div>
@@ -1,3 +1,4 @@
1
1
  // file is used for the production since the initializing of the app will happen in Q
2
2
  import App from "./App.svelte";
3
+ import "./main.scss";
3
4
  export default App;
@@ -0,0 +1 @@
1
+ @use "App.scss";
@@ -0,0 +1,18 @@
1
+ import App from "./App.svelte";
2
+ import "./main.scss";
3
+
4
+ const app = new App({
5
+ target: document.querySelector("#custom-code-fw"),
6
+ props: {
7
+ name: "custom-code-skeleton - Fullwidth",
8
+ },
9
+ });
10
+
11
+ new App({
12
+ target: document.querySelector("#custom-code-cw"),
13
+ props: {
14
+ name: "custom-code-skeleton - Content Width",
15
+ },
16
+ });
17
+
18
+ export default app;
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "@tsconfig/svelte/tsconfig.json",
3
+ "include": ["src/**/*"],
4
+ "exclude": ["node_modules/*", "__sapper__/*", "public/*"],
5
+ "compilerOptions": {
6
+ "lib": ["es2015", "DOM"],
7
+ "types": ["svelte"],
8
+ "outDir": "public",
9
+ "declaration": false,
10
+ "paths": {
11
+ "@src": ["./src/"],
12
+ "@interfaces": ["./src/interfaces.ts"]
13
+ }
14
+ }
15
+ }
@@ -12,9 +12,6 @@ module.exports = [
12
12
  password: Joi.string().required(),
13
13
  },
14
14
  },
15
- cors: {
16
- credentials: true,
17
- },
18
15
  },
19
16
  handler: async (request, h) => {
20
17
  if (
@@ -33,9 +30,6 @@ module.exports = [
33
30
  method: "GET",
34
31
  config: {
35
32
  auth: "q-auth",
36
- cors: {
37
- credentials: true,
38
- },
39
33
  },
40
34
  handler: (request, h) => {
41
35
  if (!request.auth.isAuthenticated) {
@@ -83,9 +77,6 @@ module.exports = [
83
77
  allowUnknown: true,
84
78
  },
85
79
  },
86
- cors: {
87
- credentials: true,
88
- },
89
80
  },
90
81
  handler: async (request, h) => {
91
82
  return "ok";
@@ -57,9 +57,7 @@ async function start() {
57
57
  tools: toolsConfig,
58
58
  targets: require("./config/targets.js"),
59
59
  },
60
- routes: {
61
- cors: true,
62
- },
60
+ routes: {},
63
61
  };
64
62
 
65
63
  server = Hapi.server(hapiOptions);
@@ -1 +1 @@
1
- 14
1
+ 16
@@ -0,0 +1,26 @@
1
+ dist: trusty
2
+ sudo: true
3
+ services:
4
+ - docker
5
+ language: node_js
6
+ node_js:
7
+ - "16"
8
+ cache:
9
+ directories:
10
+ - node_modules
11
+ install:
12
+ - npm install
13
+ before_script:
14
+ # TODO: Rename 'q-your-tool' to 'q-<tool-name>'
15
+ - DOCKER_IMAGE_NAME="q-your-tool"
16
+ - DOCKER_TAG=${TRAVIS_BRANCH//[^a-zA-Z0-9\_\-\.]/_}
17
+ script:
18
+ - npm run build
19
+ - npm run test
20
+ - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then docker build -t $DOCKER_IMAGE_NAME:$DOCKER_TAG .; fi'
21
+ after_success:
22
+ - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then echo $DOCKER_PASSWORD | docker login -u="$DOCKER_USERNAME" --password-stdin; docker tag $DOCKER_IMAGE_NAME:$DOCKER_TAG nzzonline/$DOCKER_IMAGE_NAME:$DOCKER_TAG; docker push nzzonline/$DOCKER_IMAGE_NAME:$DOCKER_TAG; fi'
23
+ # TODO: Create token for slack notifications with the slack bot, then insert below & uncomment lines
24
+ # notifications:
25
+ # slack:
26
+ # secure: <Slack-Token>
@@ -0,0 +1,5 @@
1
+ {
2
+ "[svelte]": {
3
+ "editor.defaultFormatter": "svelte.svelte-vscode"
4
+ }
5
+ }
@@ -1,5 +1,5 @@
1
1
  # Use following version of node alpine as the base image
2
- FROM node:14-alpine
2
+ FROM node:16-alpine
3
3
 
4
4
  # Set work directory for run/cmd
5
5
  WORKDIR /app
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 NZZ
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -41,7 +41,7 @@ npx @nzz/q-cli server
41
41
  Run the Q tool:
42
42
 
43
43
  ```
44
- node index.js
44
+ npm run dev
45
45
  ```
46
46
 
47
47
  [to the top](#table-of-contents)
@@ -1,12 +1,7 @@
1
1
  const Hapi = require("@hapi/hapi");
2
2
  const Joi = require("joi");
3
3
 
4
- const server = Hapi.server({
5
- port: process.env.PORT || 3000,
6
- routes: {
7
- cors: true,
8
- },
9
- });
4
+ const server = Hapi.server({ port: process.env.PORT || 3000 });
10
5
  server.validator(Joi);
11
6
 
12
7
  const routes = require("./routes/routes.js");