Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

Commit 1375c99

Browse files
committed
feat(routes): added route for api
1 parent f070795 commit 1375c99

4 files changed

Lines changed: 30 additions & 7 deletions

File tree

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ RUN yarn workspaces focus --all --production
4545

4646
USER node
4747

48+
EXPOSE 4000
49+
4850
CMD ["node", "dist/index.js"]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@sapphire/discord.js-utilities": "^4.1.4",
5858
"@sapphire/framework": "^2.2.0",
5959
"@sapphire/pieces": "3.2.0",
60-
"@sapphire/plugin-api": "^3.1.0",
60+
"@sapphire/plugin-api": "^3.1.1",
6161
"@sapphire/plugin-logger": "^2.1.0",
6262
"@sapphire/utilities": "^3.1.0",
6363
"@sentry/node": "^6.15.0",

src/routes/hello-world.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { ApplyOptions } from '@sapphire/decorators'
2+
import {
3+
ApiRequest,
4+
ApiResponse,
5+
methods,
6+
Route,
7+
RouteOptions,
8+
} from '@sapphire/plugin-api'
9+
10+
@ApplyOptions<RouteOptions>({
11+
route: 'hello-world',
12+
})
13+
export class UserRoute extends Route {
14+
public [methods.GET](_request: ApiRequest, response: ApiResponse) {
15+
response.json({ message: 'Hello World' })
16+
}
17+
18+
public [methods.POST](_request: ApiRequest, response: ApiResponse) {
19+
response.json({ message: 'Hello World' })
20+
}
21+
}

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -720,17 +720,17 @@ __metadata:
720720
languageName: node
721721
linkType: hard
722722

723-
"@sapphire/plugin-api@npm:^3.1.0":
724-
version: 3.1.0
725-
resolution: "@sapphire/plugin-api@npm:3.1.0"
723+
"@sapphire/plugin-api@npm:^3.1.1":
724+
version: 3.1.1
725+
resolution: "@sapphire/plugin-api@npm:3.1.1"
726726
dependencies:
727727
"@types/node-fetch": 2.5.12
728728
"@types/psl": ^1.1.0
729-
"@types/ws": ^8.2.0
729+
"@types/ws": ^8.2.1
730730
node-fetch: 2.6.6
731731
psl: ^1.8.0
732732
tslib: ^2.3.1
733-
checksum: ea947a050c632ef60c67ed2787bb64bf68cf3f60a2dd6c9790bea18f9cefeefeca2bf9379234546b48a738fa445726f76517abd54b8600eda8bf98c66b6507b5
733+
checksum: 0d2f1a0f23c5486f4a5c9df2921f3ea7d02b53545989d9b84aa190bce035823bc8ca9574875e9c3fb6ecd7e5507ec412774cf4d63a0e86c9c156b8c368815963
734734
languageName: node
735735
linkType: hard
736736

@@ -2967,7 +2967,7 @@ __metadata:
29672967
"@sapphire/discord.js-utilities": ^4.1.4
29682968
"@sapphire/framework": ^2.2.0
29692969
"@sapphire/pieces": 3.2.0
2970-
"@sapphire/plugin-api": ^3.1.0
2970+
"@sapphire/plugin-api": ^3.1.1
29712971
"@sapphire/plugin-logger": ^2.1.0
29722972
"@sapphire/utilities": ^3.1.0
29732973
"@semantic-release/changelog": ^6.0.1

0 commit comments

Comments
 (0)