-
Notifications
You must be signed in to change notification settings - Fork 10
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
Showing
10 changed files
with
126 additions
and
4 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,6 @@ | ||
@apiUrl = http://127.0.0.1:8000 | ||
@apiVersion = v0 | ||
@token = YOUR_SECRET_TOKEN | ||
|
||
### Home | ||
GET {{apiUrl}}/{{apiVersion}} |
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,51 @@ | ||
{ | ||
"name": "@alwatr/com-api", | ||
"version": "0.27.0", | ||
"description": "Alwatr Customer Order Management API Microservice", | ||
"type": "module", | ||
"author": "S. Ali Mihandoost <[email protected]> (https://ali.mihandoost.com)", | ||
"contributors": [ | ||
"S. Amir Mohammad Najafi <[email protected]> (https://njfamirm.ir)" | ||
], | ||
"private": true, | ||
"engines": { | ||
"node": ">=19.0.0", | ||
"npm": ">=8.0.0", | ||
"yarn": ">=1.22.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/AliMD/alwatr", | ||
"directory": "uniquely/com-api" | ||
}, | ||
"scripts": { | ||
"b": "yarn build", | ||
"c": "yarn clean", | ||
"cb": "run-s clean build", | ||
"s": "yarn start", | ||
"w": "yarn watch", | ||
"start": "NODE_OPTIONS=--enable-source-maps run-s clean build serve", | ||
"build": "yarn build:es --analyze=verbose", | ||
"build:ts": "tsc --build", | ||
"build:es": "esbuild src/index.ts --platform=node --target=node19 --bundle --format=esm --minify --sourcemap --outdir=dist --out-extension:.js=.mjs", | ||
"clean": "rimraf dist build .tsbuildinfo **/*.{d.ts,map} src/**/*.{js,cjs,mjs}", | ||
"serve": "node --enable-source-maps dist/index.mjs", | ||
"serve:debug": "node --inspect --enable-source-maps dist/index.mjs", | ||
"watch": "run-s clean build && run-p watch:es watch:node", | ||
"watch:node": "nodemon -w dist/ --enable-source-maps dist/index.mjs", | ||
"watch:debug-node": "nodemon -w dist/ --inspect --enable-source-maps dist/index.mjs", | ||
"watch:ts": "yarn build:ts --watch --preserveWatchOutput", | ||
"watch:es": "yarn build:es --watch" | ||
}, | ||
"devDependencies": { | ||
"@alwatr/logger": "~0.27.0", | ||
"@alwatr/nano-server": "~0.27.0", | ||
"@alwatr/storage-client": "~0.27.0", | ||
"@types/node": "~18.11.18", | ||
"esbuild": "~0.16.11", | ||
"nodemon": "~2.0.20", | ||
"npm-run-all": "~4.1.5", | ||
"rimraf": "~3.0.2", | ||
"typescript": "~4.9.4" | ||
} | ||
} |
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 @@ | ||
import {createLogger} from '@alwatr/logger'; | ||
|
||
export const logger = createLogger('com-api'); | ||
|
||
export const config = { | ||
storage: { | ||
host: process.env.STORAGE_HOST ?? '127.0.0.1', | ||
port: process.env.STORAGE_PORT != null ? +process.env.STORAGE_PORT : 9000, | ||
name: process.env.STORAGE_NAME ?? 'job', | ||
token: process.env.STORAGE_TOKEN ?? 'YOUR_SECRET_TOKEN', | ||
}, | ||
nanoServer: { | ||
host: process.env.HOST ?? '0.0.0.0', | ||
port: process.env.PORT != null ? +process.env.PORT : 8000, | ||
accessToken: process.env.ACCESS_TOKEN ?? 'YOUR_SECRET_TOKEN', | ||
allowAllOrigin: true, | ||
}, | ||
}; | ||
|
||
logger.logProperty('config', config); |
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,4 @@ | ||
import './route/home.js'; | ||
import {logger} from './config.js'; | ||
|
||
logger.logOther('..:: Customer Order Management API ::..'); |
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 @@ | ||
import {AlwatrNanoServer} from '@alwatr/nano-server'; | ||
|
||
import {config} from '../config.js'; | ||
|
||
export const nanoServer = new AlwatrNanoServer(config.nanoServer); |
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 @@ | ||
import {AlwatrStorageClient} from '@alwatr/storage-client'; | ||
|
||
import {config} from '../config.js'; | ||
|
||
export const storageClient = new AlwatrStorageClient(config.storage); |
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 {nanoServer} from '../lib/nano-server.js'; | ||
|
||
nanoServer.route('GET', '/', () => ({ | ||
ok: true, | ||
data: { | ||
app: 'Alwatr Customer Order Management API Microservice', | ||
message: 'Hello ;)', | ||
}, | ||
})); |
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 @@ | ||
{ | ||
"extends": "../../tsconfig.base", | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"composite": true, | ||
"tsBuildInfoFile": ".tsbuildinfo", | ||
"rootDir": "src", | ||
"outDir": "build", | ||
// "noEmit": true | ||
}, | ||
|
||
"include": ["src/**/*.ts"], | ||
"exclude": [], | ||
"references": [ | ||
{"path": "../../core/nano-server"}, | ||
{"path": "../../core/logger"}, | ||
{"path": "../../core/storage-client"}, | ||
] | ||
} |
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 |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
"description": "Alwatr Flight Finder API Microservice", | ||
"type": "module", | ||
"author": "S. Ali Mihandoost <[email protected]> (https://ali.mihandoost.com)", | ||
"contributors": [ | ||
"S. Amir Mohammad Najafi <[email protected]> (https://njfamirm.ir)" | ||
], | ||
"private": true, | ||
"engines": { | ||
"node": ">=19.0.0", | ||
|
@@ -12,8 +15,8 @@ | |
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/AliMD/flight-finder", | ||
"directory": "api" | ||
"url": "https://github.com/AliMD/alwatr", | ||
"directory": "uniquely/flight-finder-api" | ||
}, | ||
"scripts": { | ||
"b": "yarn build", | ||
|
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