+ adding hono and @hono/node-server
+ reemplazar index por server.ts + implement a basic server.ts in server.ts
This commit is contained in:
23
package-lock.json
generated
23
package-lock.json
generated
@ -9,6 +9,8 @@
|
|||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@hono/node-server": "^1.17.1",
|
||||||
|
"hono": "^4.8.9",
|
||||||
"mongoose": "^8.16.5",
|
"mongoose": "^8.16.5",
|
||||||
"pino": "^9.7.0"
|
"pino": "^9.7.0"
|
||||||
},
|
},
|
||||||
@ -1254,6 +1256,18 @@
|
|||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@hono/node-server": {
|
||||||
|
"version": "1.17.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.17.1.tgz",
|
||||||
|
"integrity": "sha512-SY79W/C+2b1MyAzmIcV32Q47vO1b5XwLRwj8S9N6Jr5n1QCkIfAIH6umOSgqWZ4/v67hg6qq8Ha5vZonVidGsg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.14.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"hono": "^4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@humanfs/core": {
|
"node_modules/@humanfs/core": {
|
||||||
"version": "0.19.1",
|
"version": "0.19.1",
|
||||||
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
|
||||||
@ -4153,6 +4167,15 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/hono": {
|
||||||
|
"version": "4.8.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/hono/-/hono-4.8.9.tgz",
|
||||||
|
"integrity": "sha512-ERIxkXMRhUxGV7nS/Af52+j2KL60B1eg+k6cPtgzrGughS+espS9KQ7QO0SMnevtmRlBfAcN0mf1jKtO6j/doA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/html-escaper": {
|
"node_modules/html-escaper": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"start": "node dist/index.js",
|
"start": "node dist/server.js",
|
||||||
"dev": "tsx watch src/index.ts",
|
"dev": "tsx watch src/server.ts",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"lint": "eslint src/**/*.ts",
|
"lint": "eslint src/**/*.ts",
|
||||||
@ -36,6 +36,8 @@
|
|||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@hono/node-server": "^1.17.1",
|
||||||
|
"hono": "^4.8.9",
|
||||||
"mongoose": "^8.16.5",
|
"mongoose": "^8.16.5",
|
||||||
"pino": "^9.7.0"
|
"pino": "^9.7.0"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
const helloFn = (name) => {
|
|
||||||
return `Hola ${name}`;
|
|
||||||
};
|
|
||||||
console.log(helloFn("Mundo"));
|
|
9
src/server.ts
Normal file
9
src/server.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// server.ts
|
||||||
|
import { Hono } from 'hono';
|
||||||
|
import { serve } from '@hono/node-server';
|
||||||
|
|
||||||
|
const app = new Hono();
|
||||||
|
|
||||||
|
app.get('/', (c) => c.text('Hello world'));
|
||||||
|
|
||||||
|
serve({ fetch: app.fetch, port: 3000 });
|
Reference in New Issue
Block a user