-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e6c830
commit 8ff2567
Showing
14 changed files
with
261 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"overrides": [ | ||
{ | ||
"env": { | ||
"node": true | ||
}, | ||
"files": [ | ||
".eslintrc.{js,cjs}" | ||
], | ||
"parserOptions": { | ||
"sourceType": "script" | ||
} | ||
} | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var express = require('express'); | ||
var app = express(); | ||
app.get('/', function (req, res) { | ||
console.log('🔍 Serving endpoint "/"'); | ||
res.send(returnHelloMessage()); | ||
}); | ||
app.listen(3000, function () { | ||
console.log('🚀 Server is started and is listening on port 3000!'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "js-server", | ||
"version": "1.0.0", | ||
"description": "A simple REST server written in node.js", | ||
"main": "app.js", | ||
"scripts": { | ||
"start": "node app.js", | ||
"test": "mocha --recursive test", | ||
"lint": "eslint --ext=.jsx,.js,.tsx,.ts" | ||
}, | ||
"author": "OpsVerse", | ||
"license": "ISC", | ||
"dependencies": { | ||
"express": "^4.18.2" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^8.55.0", | ||
"mocha": "^10.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
exec node /usr/src/app/app.js "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
continuation_indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# https://hub.docker.com/_/node | ||
FROM node:18 | ||
|
||
# Create and change to the app directory. | ||
WORKDIR /usr/src/app | ||
|
||
# Copy application dependency manifests to the container image. | ||
# A wildcard is used to ensure both package.json AND package-lock.json are copied. | ||
# Copying this separately prevents re-running npm install on every code change. | ||
COPY package*.json ./ | ||
|
||
# Install production dependencies. | ||
RUN npm install --only=production | ||
|
||
# Copy local code to the container image. | ||
COPY . . | ||
|
||
# Run the web service on container startup. | ||
CMD [ "node", "app.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ${{values.component_id}} | ||
|
||
${{values.description}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
name: ${{values.component_id | dump}} | ||
{%- if values.description %} | ||
description: ${{values.description | dump}} | ||
{%- endif %} | ||
annotations: | ||
github.com/project-slug: ${{values.destination.owner + "/" + values.destination.repo}} | ||
backstage.io/techdocs-ref: dir:. | ||
spec: | ||
type: service | ||
lifecycle: experimental | ||
owner: ${{values.owner | dump}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## ${{ values.component_id }} | ||
|
||
${{ values.description }} | ||
|
||
## Getting started | ||
|
||
Start write your documentation by adding more markdown (.md) files to this folder (/docs) or replace the content in this file. | ||
|
||
## Table of Contents | ||
|
||
The Table of Contents on the right is generated automatically based on the hierarchy | ||
of headings. Only use one H1 (`#` in Markdown) per file. | ||
|
||
## Site navigation | ||
|
||
For new pages to appear in the left hand navigation you need edit the `mkdocs.yml` | ||
file in root of your repo. The navigation can also link out to other sites. | ||
|
||
Alternatively, if there is no `nav` section in `mkdocs.yml`, a navigation section | ||
will be created for you. However, you will not be able to use alternate titles for | ||
pages, or include links to other sites. | ||
|
||
Note that MkDocs uses `mkdocs.yml`, not `mkdocs.yaml`, although both appear to work. | ||
See also <https://www.mkdocs.org/user-guide/configuration/>. | ||
|
||
## Support | ||
|
||
That's it. If you need support, reach out in [#docs-like-code](https://discord.com/channels/687207715902193673/714754240933003266) on Discord. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
site_name: ${{values.component_id | dump}} | ||
site_description: ${{values.description | dump}} | ||
|
||
nav: | ||
- Introduction: index.md | ||
|
||
plugins: | ||
- techdocs-core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": ${{values.artifact_id}}, | ||
"version": "1.0.0", | ||
"description": ${{values.description}}, | ||
"main": "app.js", | ||
"scripts": { | ||
"start": "node app.js", | ||
"test": "mocha --recursive test", | ||
"lint": "eslint --ext=.jsx,.js,.tsx,.ts" | ||
}, | ||
"license": "ISC", | ||
"dependencies": { | ||
"express": "^4.18.2" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^8.55.0", | ||
"mocha": "^10.2.0" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const returnHelloMessage = async () => { | ||
return "Hello World!"; | ||
} | ||
|
||
module.exports.saveUser = returnHelloMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
apiVersion: scaffolder.backstage.io/v1beta3 | ||
kind: Template | ||
metadata: | ||
name: node-js-server-template | ||
title: Node.js REST Service | ||
description: Create a simple RESTful microservice using Node.js (express) | ||
tags: | ||
- recommended | ||
- node.js | ||
- REST | ||
- express | ||
spec: | ||
owner: [email protected] | ||
type: service | ||
|
||
parameters: | ||
- title: Provide some simple information | ||
required: | ||
- component_id | ||
- owner | ||
- java_package_name | ||
properties: | ||
component_id: | ||
title: Name | ||
type: string | ||
description: Unique name of the component | ||
ui:field: EntityNamePicker | ||
description: | ||
title: Description | ||
type: string | ||
description: Help others understand what this website is for. | ||
owner: | ||
title: Owner | ||
type: string | ||
description: Owner of the component | ||
ui:field: OwnerPicker | ||
ui:options: | ||
allowedKinds: | ||
- Group | ||
- title: Choose a location | ||
required: | ||
- repoUrl | ||
properties: | ||
repoUrl: | ||
title: Repository Location | ||
type: string | ||
ui:field: RepoUrlPicker | ||
ui:options: | ||
allowedHosts: | ||
- github.com | ||
|
||
steps: | ||
- id: template | ||
name: Fetch Skeleton + Template | ||
action: fetch:template | ||
input: | ||
url: ./skeleton | ||
copyWithoutRender: | ||
- .github/workflows/* | ||
values: | ||
component_id: ${{ parameters.component_id }} | ||
description: ${{ parameters.description }} | ||
artifact_id: ${{ parameters.component_id }} | ||
java_package_name: ${{ parameters.java_package_name }} | ||
owner: ${{ parameters.owner }} | ||
destination: ${{ parameters.repoUrl | parseRepoUrl }} | ||
http_port: 8080 | ||
|
||
- id: publish | ||
name: Publish | ||
action: publish:github | ||
input: | ||
allowedHosts: ["github.com"] | ||
description: This is ${{ parameters.component_id }} | ||
repoUrl: ${{ parameters.repoUrl }} | ||
|
||
- id: register | ||
name: Register | ||
action: catalog:register | ||
input: | ||
repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }} | ||
catalogInfoPath: "/catalog-info.yaml" | ||
|
||
output: | ||
links: | ||
- title: Repository | ||
url: ${{ steps.publish.output.remoteUrl }} | ||
- title: Open in catalog | ||
icon: catalog | ||
entityRef: ${{ steps.register.output.entityRef }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
describe("Hello world Service Unit Tests", function () { | ||
describe("Return 'Hello World' message functionality", function () { | ||
it("should successfully return 'Hello World'", async function () { | ||
}); | ||
it("should throw an error message", async function () { | ||
}); | ||
}); | ||
}); |