-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from unarxiv/discovery
open-source typescript based discovery service
- Loading branch information
Showing
16 changed files
with
3,910 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,2 @@ | ||
node_modules/ | ||
dist/ |
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 @@ | ||
# README |
Large diffs are not rendered by default.
Oops, something went wrong.
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,35 @@ | ||
{ | ||
"name": "cvtron-discovery-node", | ||
"version": "1.0.0", | ||
"description": "The CVTron Discovery Service in Node", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build-server": "tslint --project . && tsc", | ||
"watch-server": "nodemon --watch 'src/**/*' -e ts,tsx --exec 'ts-node' ./src/server.ts" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@aws/dynamodb-data-mapper": "^0.7.3", | ||
"@aws/dynamodb-data-mapper-annotations": "^0.7.3", | ||
"@koa/cors": "^2.2.2", | ||
"@types/koa": "^2.0.46", | ||
"@types/koa-bodyparser": "^5.0.1", | ||
"@types/koa-helmet": "^3.1.2", | ||
"@types/koa-router": "^7.0.32", | ||
"@types/koa__cors": "^2.2.3", | ||
"aws-sdk": "^2.348.0", | ||
"koa": "^2.6.1", | ||
"koa-bodyparser": "^4.2.1", | ||
"koa-helmet": "^4.0.0", | ||
"koa-router": "^7.4.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^10.12.2", | ||
"nodemon": "^1.18.5", | ||
"ts-node": "^7.0.1", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.1.6" | ||
} | ||
} |
Empty file.
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 @@ | ||
export { default as system } from './system'; |
Empty file.
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 @@ | ||
import { BaseContext } from 'koa'; | ||
|
||
export default class SystemController { | ||
public static async getSystemStatus(ctx: BaseContext) { | ||
ctx.status = 200; | ||
ctx.body = 'ok'; | ||
} | ||
} |
Empty file.
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 @@ | ||
/** | ||
* Following will be object manipulations | ||
*/ |
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,11 @@ | ||
|
||
/** | ||
* Following is the definition for mapper | ||
*/ | ||
|
||
import { DataMapper } from '@aws/dynamodb-data-mapper'; | ||
import DynamoDB = require('aws-sdk/clients/dynamodb'); | ||
|
||
const mapper = new DataMapper({ | ||
client: new DynamoDB({region: 'us-east-1'}) | ||
}) |
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,24 @@ | ||
import { | ||
attribute, | ||
hashKey, | ||
rangeKey, | ||
table, | ||
} from '@aws/dynamodb-data-mapper-annotations'; | ||
|
||
/** | ||
* Following will be object definitions | ||
*/ | ||
@table('cvpm-package') | ||
class Package { | ||
@hashKey() | ||
id: string; | ||
|
||
@rangeKey({defaultProvider: () => new Date()}) | ||
createdAt: Date; | ||
|
||
@attribute() | ||
isSymbol: boolean; | ||
|
||
@attribute() | ||
linkedTo: string; | ||
} |
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 @@ | ||
import * as Router from 'koa-router'; | ||
|
||
import controller = require('./controller'); | ||
|
||
const router = new Router(); | ||
|
||
router.get('/system/status', controller.system.getSystemStatus); | ||
|
||
export { router }; |
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,16 @@ | ||
import * as cors from '@koa/cors'; | ||
import * as Koa from 'koa'; | ||
import * as bodyParser from 'koa-bodyparser'; | ||
import * as helmet from 'koa-helmet'; | ||
|
||
import { router } from './routes'; | ||
|
||
const app = new Koa(); | ||
|
||
app.use(cors()); | ||
app.use(helmet()); | ||
app.use(bodyParser()); | ||
app.use(router.routes()).use(router.allowedMethods()); | ||
|
||
app.listen(3000); | ||
console.log('Server is Running on 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,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es2017", | ||
"noImplicitAny": true, | ||
"outDir": "./dist", | ||
"sourceMap": true, | ||
"experimentalDecorators": true | ||
}, | ||
"include": [ | ||
"./src/**/*" | ||
] | ||
} |
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,29 @@ | ||
{ | ||
"defaultSeverity": "error", | ||
"extends": [ | ||
"tslint:recommended" | ||
], | ||
"jsRules": {}, | ||
"rules": { | ||
"quotemark": [ | ||
true, | ||
"single" | ||
], | ||
"no-console": [ | ||
false | ||
], | ||
"one-line": [ | ||
true, | ||
"check-open-brace", | ||
"check-whitespace" | ||
], | ||
"object-literal-sort-keys": [ | ||
false | ||
], | ||
"no-string-literal": false, | ||
"triple-equals": [ | ||
false | ||
] | ||
}, | ||
"rulesDirectory": [] | ||
} |