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

Commit 19da8eb

Browse files
committed
🎉 feat: init
0 parents  commit 19da8eb

File tree

16 files changed

+788
-0
lines changed

16 files changed

+788
-0
lines changed

.cjs.swcrc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"module": {
3+
"type": "commonjs"
4+
},
5+
"exclude": ["(.*).(spec|test).(j|t)s$"],
6+
"jsc": {
7+
"target": "es2020",
8+
"parser": {
9+
"syntax": "typescript"
10+
},
11+
"minify": {
12+
"mangle": true,
13+
"compress": true
14+
}
15+
},
16+
"minify": false,
17+
"sourceMaps": true,
18+
"inlineSourcesContent": true,
19+
"env": {
20+
"targets": {
21+
"node": 16
22+
}
23+
}
24+
}

.es.swcrc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"module": {
3+
"type": "nodenext"
4+
},
5+
"exclude": ["(.*).(spec|test).(j|t)s$"],
6+
"jsc": {
7+
"target": "es2020",
8+
"parser": {
9+
"syntax": "typescript"
10+
},
11+
"minify": {
12+
"mangle": true,
13+
"compress": true
14+
}
15+
},
16+
"minify": false,
17+
"sourceMaps": true,
18+
"inlineSourcesContent": true,
19+
"env": {
20+
"targets": {
21+
"node": 16
22+
}
23+
}
24+
}

.eslintrc.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
"env": {
3+
"es2021": true,
4+
"node": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended"
9+
],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"ecmaVersion": "latest",
13+
"sourceType": "module"
14+
},
15+
"plugins": [
16+
"@typescript-eslint"
17+
],
18+
"rules": {
19+
"@typescript-eslint/ban-types": 'off',
20+
'@typescript-eslint/no-explicit-any': 'off'
21+
},
22+
"ignorePatterns": ["example/*", "tests/**/*"]
23+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
3+
node_modules
4+
.pnpm-debug.log
5+
dist

.npmignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.git
2+
.gitignore
3+
.prettierrc
4+
.cjs.swcrc
5+
.es.swcrc
6+
bun.lockb
7+
8+
node_modules
9+
tsconfig.json
10+
pnpm-lock.yaml
11+
jest.config.js
12+
nodemon.json
13+
14+
example
15+
tests
16+
test
17+
CHANGELOG.md
18+
.eslintrc.js
19+
tsconfig.cjs.json
20+
tsconfig.esm.json

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# 0.1.0-rc.1 - 6 Dec 2022
2+
Improvement:
3+
- Support for Elysia 0.1.0-rc.1 onward
4+
5+
# 0.0.0-experimental.1 - 1 Dec 2022
6+
Improvement:
7+
- using `.inject` instead of hacking with `Object.assign`

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2023 saltyAom
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# @elysiajs/node
2+
3+
### This plugin is in an experimental state (under heavy development), and SHOULD NOT BE USED on production
4+
5+
Plugin for [elysia](https://github.com/elysiajs/elysia) using Elysia on NodeJS
6+
7+
## Installation
8+
```bash
9+
bun add @elysiajs/node
10+
```
11+
12+
## Example
13+
```typescript
14+
import { Elysia } from 'elysia'
15+
import { node } from '@elysiajs/node'
16+
17+
const app = new Elysia()
18+
.get('/', () => 'hi')
19+
.use(node(8080))
20+
```

bun.lockb

46.7 KB
Binary file not shown.

example/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Elysia, t, ws } from 'elysia'
2+
import { node } from '../src'
3+
4+
const app = new Elysia()
5+
.use(ws())
6+
.ws('/a', {
7+
message(ws, message) {
8+
ws.send(message)
9+
}
10+
})
11+
.get('/', () => 'Hi')
12+
.get('/id/:id', (c) => {
13+
c.set.headers['x-powered-by'] = 'benchmark'
14+
15+
return `${c.params.id} ${c.query.name}`
16+
})
17+
.post('/', ({ body }) => 'hi')
18+
.post('/mirror', ({ body }) => body, {
19+
type: 'json'
20+
})
21+
.use(
22+
node(8080, (port) => {
23+
console.log('Listening at :8080')
24+
})
25+
)

0 commit comments

Comments
 (0)