-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
29 changed files
with
922 additions
and
86 deletions.
There are no files selected for viewing
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
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,27 @@ | ||
# ArtusX-API | ||
|
||
> undefined project with web-server powered by ArtusX. | ||
## Usage | ||
|
||
### Development | ||
|
||
```bash | ||
pnpm i | ||
pnpm run dev | ||
``` | ||
|
||
### Production | ||
|
||
```bash | ||
pnpm run start | ||
|
||
# nohup | ||
nohup pnpm run start & | ||
``` | ||
|
||
### Requirement | ||
|
||
- Docker | ||
- Node.js 18.x | ||
- Typescript 4.x+ |
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 @@ | ||
{ | ||
"name": "artusx-legacy", | ||
"version": "1.0.0", | ||
"description": "legacy for artusx", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "", | ||
"dev": "npx nodemon src/bootstrap.ts" | ||
}, | ||
"dependencies": { | ||
"@artus/core": "^2.x", | ||
"@artusx/plugin-express": "workspace:*", | ||
"@artusx/utils": "workspace:*", | ||
"nodemon": "~3.0.2", | ||
"reflect-metadata": "^0.1.13" | ||
}, | ||
"devDependencies": { | ||
"@artus/tsconfig": "~1.0.1", | ||
"@types/node": "~20.10.6", | ||
"nodemon": "~3.0.2", | ||
"ts-node": "~10.9.2", | ||
"tslib": "~2.6.2", | ||
"typescript": "~5.3.3" | ||
} | ||
} |
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 @@ | ||
import path from 'path'; | ||
import { Application } from '@artusx/utils'; | ||
|
||
(async () => { | ||
await Application.start({ | ||
root: path.resolve(__dirname), | ||
configDir: 'config' | ||
}); | ||
|
||
// console.log(app.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 @@ | ||
export default {}; |
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 @@ | ||
export default { | ||
express: { | ||
enable: true, | ||
package: '@artusx/plugin-express' | ||
} | ||
}; |
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 @@ | ||
// import { GET, HTTPController } from '../types'; | ||
// import type { ArtusxContext } from '../types'; | ||
|
||
// @HTTPController() | ||
// export default class HomeController { | ||
// @GET('/') | ||
// async home(ctx: ArtusxContext) { | ||
// ctx.body = 'Hello World'; | ||
// } | ||
// } |
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,38 @@ | ||
import { | ||
ArtusApplication, | ||
ArtusInjectEnum, | ||
ApplicationLifecycle, | ||
Inject, | ||
LifecycleHook, | ||
LifecycleHookUnit | ||
} from '@artus/core'; | ||
import { ArtusXInjectEnum, IExpressClient } from './types'; | ||
|
||
@LifecycleHookUnit() | ||
export default class ExpressLifecycle implements ApplicationLifecycle { | ||
@Inject(ArtusInjectEnum.Application) | ||
app: ArtusApplication; | ||
|
||
@Inject(ArtusXInjectEnum.Express) | ||
express: IExpressClient; | ||
|
||
@LifecycleHook() | ||
async willReady() { | ||
const router = this.express.router; | ||
router.use((req, res, next) => { | ||
console.log('%s %s %s', req.method, req.url, req.path); | ||
res.locals.method = req.method; | ||
next(); | ||
}); | ||
|
||
router.get('/', (_req, res) => { | ||
console.log(res.locals); | ||
res.send('router - /, powered by express.js'); | ||
}); | ||
|
||
router.get('/get', (_req, res) => { | ||
console.log(res.locals); | ||
res.send('router - /get , powered by express.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,2 @@ | ||
export * from '@artusx/plugin-express'; | ||
export { default as IExpressClient } from '@artusx/plugin-express/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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "@artus/tsconfig", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"strictNullChecks": true, | ||
"resolveJsonModule": true, | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"outDir": "dist" | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.json"] | ||
} |
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
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
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
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
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 @@ | ||
lib |
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 @@ | ||
# ArtusX plugin redis | ||
|
||
> https://github.com/thonatos/artusx |
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 @@ | ||
{ | ||
"name": "express" | ||
} |
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,56 @@ | ||
{ | ||
"name": "@artusx/plugin-express", | ||
"version": "1.0.1-dev.16", | ||
"description": "express plugin for artusx", | ||
"keywords": [ | ||
"artus.js" | ||
], | ||
"license": "MIT", | ||
"author": "Suyi <[email protected]>", | ||
"exports": { | ||
".": { | ||
"types": "./lib/index.d.ts", | ||
"default": "./lib/index.js" | ||
}, | ||
"./constants": { | ||
"types": "./lib/constants.d.ts", | ||
"default": "./lib/constants.js" | ||
}, | ||
"./client": { | ||
"types": "./lib/client.d.ts", | ||
"default": "./lib/client.js" | ||
}, | ||
"./lifecycle": { | ||
"types": "./lib/lifecycle.d.ts", | ||
"default": "./lib/lifecycle.js" | ||
} | ||
}, | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.js", | ||
"files": [ | ||
"lib" | ||
], | ||
"scripts": { | ||
"build": "npm run tsc && npm run build:metadata", | ||
"build:metadata": "cp meta.json ./lib/meta.json", | ||
"tsc": "rm -rf lib && tsc" | ||
}, | ||
"dependencies": { | ||
"@artus/core": "^2.x", | ||
"@artus/pipeline": "^0.2", | ||
"express": "~4.18.2" | ||
}, | ||
"devDependencies": { | ||
"@artus/tsconfig": "^1.0.1", | ||
"@types/express": "~4.17.21", | ||
"@types/node": "^18.11.17", | ||
"tslib": "^2.5.0", | ||
"typescript": "^4.9.4" | ||
}, | ||
"peerDependencies": { | ||
"reflect-metadata": "^0.1.13" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Oops, something went wrong.