Skip to content

Commit 80c87c8

Browse files
committed
initial commit
1 parent b43d456 commit 80c87c8

20 files changed

+16538
-1
lines changed

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules
2+
/reports
3+
/build
4+
/coverage

.eslintrc.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": ["standard"],
7+
"parser": "@typescript-eslint/parser",
8+
"parserOptions": {
9+
"ecmaVersion": 13,
10+
"sourceType": "module"
11+
},
12+
"plugins": ["@typescript-eslint"],
13+
"rules": {}
14+
}

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.env
2+
build
3+
node_modules
4+
coverage

Dockerfile

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# base image
2+
FROM node:lts-alpine as base
3+
ENV APP_DIR=/home/node/app
4+
RUN apk add --no-cache tini && \
5+
mkdir $APP_DIR && chown node:node $APP_DIR
6+
WORKDIR $APP_DIR
7+
ENTRYPOINT ["/sbin/tini", "--"]
8+
COPY --chown=node:node package.json package-lock.json* npm-shrinkwrap.json* tsoa.json ./
9+
10+
# build and test
11+
FROM base as test
12+
RUN apk add --no-cache --virtual .gyp python3 make g++ \
13+
&& npm ci \
14+
&& apk del .gyp
15+
COPY --chown=node:node src ./src
16+
RUN npm run build && \
17+
npm run lint && \
18+
npm run test
19+
20+
# runtime
21+
FROM base
22+
COPY --chown=node:node src ./src
23+
ENV NODE_ENV production
24+
RUN npm ci --ignore-scripts && \
25+
npm install -g ts-node && \
26+
npm run build
27+
28+
ENV PORT=8080
29+
USER node
30+
EXPOSE 8080
31+
CMD ["npm", "start"]

README.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1-
# appid-api
1+
# appid-api
2+
Stubbed out NodeJS REST API for interacting with the AppID Service. This is a work in progress.
3+
4+
## Environment Variables
5+
Required:
6+
```
7+
IBMCLOUD_API_KEY="";
8+
APPID_SERVICE_ENDPOINT="https://us-south.appid.cloud.ibm.com";
9+
APPID_API_TENANT_ID="";
10+
```
11+
12+
Optional:
13+
```
14+
PORT=8080
15+
```
16+
17+
## Docker Image
18+
Building:
19+
```
20+
docker build -t michaelsteven/appid-api:latest
21+
```
22+
23+
Running:
24+
```
25+
docker run --env-file=.env -p 8080:8080 michaelsteven/appid-api:latest
26+
```
27+
28+
## Licensing
29+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at http://ww.apache.org/licenses/LICENSE-2.0
30+
31+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permission and limitations under the License.

babel.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
presets: [
3+
['@babel/preset-env', {targets: {node: 'current'}}],
4+
'@babel/preset-typescript',
5+
],
6+
};

jest.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
transform: {
6+
"^.+\\.(ts|tsx)$": "ts-jest",
7+
"^.+\\.(js)$": "babel-jest",
8+
},
9+
transformIgnorePatterns: [
10+
],
11+
};

0 commit comments

Comments
 (0)