GithubHelp home page GithubHelp logo

nhttp / nhttp Goto Github PK

View Code? Open in Web Editor NEW
82.0 82.0 6.0 1.16 MB

An Simple web-framework for Deno and Friends.

Home Page: https://nhttp.deno.dev

License: MIT License

TypeScript 81.06% JavaScript 18.92% CSS 0.01% HTML 0.01%
bun cloudflare-workers deno http-server nodejs

nhttp's Introduction

logo

NHttp

An Simple web-framework for Deno and Friends.

ci coverage codefactor denoland deps size size licence prs nestland


Features

  • Focus on simple and easy to use.
  • Fast Performance. One of the fastest Frameworks.
  • Cross runtime support (Deno, Node, Bun, etc).
  • Low overhead & True handlers (no caching anything).
  • Built-in Middleware.
  • Sub router support.
  • Template engine support (jsx, ejs, nunjucks, eta, pug, ..etc).
  • Return directly on handlers.
  • Auto parses the body (json / urlencoded / multipart / raw).

See Examples

v1.3.0 requires Deno 1.35 or higher.

CLI

Deno

deno run -Ar npm:create-nhttp

Npm

npm create nhttp@latest

Manual Installation

deno.land

import nhttp from "https://deno.land/x/nhttp/mod.ts";

deno-npm

import nhttp from "npm:nhttp-land";

npm/yarn

npm i nhttp-land

// or

yarn add nhttp-land
// module
import nhttp from "nhttp-land";

// commonjs
const nhttp = require("nhttp-land").default;

Simple Usage

Create file app.ts and copy-paste this code.

import nhttp from "https://deno.land/x/nhttp/mod.ts";

const app = nhttp();

app.get("/", () => {
  return "Hello, World";
});

app.get("/cat", () => {
  return { name: "cat" };
});

app.listen(8000);

Run

deno run -A app.ts

Using JSX + Htmx

Create file app.tsx and copy-paste this code.

/** @jsx n */
/** @jsxFrag n.Fragment */

import nhttp from "https://deno.land/x/nhttp/mod.ts";
import { htmx, n, renderToHtml } from "https://deno.land/x/nhttp/lib/jsx.ts";

const app = nhttp();

app.engine(renderToHtml);

app.use(htmx());

app.get("/", () => {
  return (
    <button hx-post="/clicked" hx-swap="outerHTML">
      Click Me
    </button>
  );
});

app.post("/clicked", () => {
  return <span>It's Me</span>;
});

app.listen(8000);

Run

deno run -A app.tsx

more docs => https://nhttp.deno.dev

3rd-party libs

Like std-libs for NHttp.

Usage

// Deno
import {...} from "https://deno.land/x/nhttp/lib/my-libs.ts";

// Deno NPM
import {...} from "npm:nhttp-land/my-libs";

// Node or Bun
import {...} from "nhttp-land/my-libs";

ServeStatic

import nhttp from "https://deno.land/x/nhttp/mod.ts";
import serveStatic from "https://deno.land/x/nhttp/lib/serve-static.ts";

const app = nhttp();

app.use(serveStatic("./my_folder"));

// with prefix
app.use(serveStatic("./my_folder", { prefix: "/assets" }));
// or
// app.use("/assets", serveStatic("./my_folder"));

// with URL
app.use(serveStatic(new URL("./my_folder", import.meta.url)));

more libs => https://nhttp.deno.dev/docs/3rd-party-lib

License

MIT

nhttp's People

Contributors

af280cf94190a54043e947948a0031ce7ed71dc avatar eevleevs avatar herudi avatar hironichu avatar izeau avatar zingmane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nhttp's Issues

nhttp react ssr

Hi @herudi ,
I hope you're well.
Tell me, any UI component framework for React works with nhttp react ssr ?

I'm very looking forward to nhttp support with vuejs ssr.

RequestEvent is undefined when using controllers

So, there's an example here:

import { nhttp, RequestEvent } from "https://deno.land/x/[email protected]/mod.ts";
import { Get, Controller } from "https://deno.land/x/[email protected]/lib/controller.ts";

@Controller("/hello")
class HelloController {

  @Get("/")
  hello(rev: RequestEvent) {
    console.log(rev.url);
    return "Hello, World";
  }

}

const app = nhttp();

app.use("/api/v1", new HelloController());
// or multi controllers
// app.use("/api/v1", [new HelloController(), new HomeController()]);

app.listen(8000);

When I go to /api/v1/hello, I get the following error:

{"status":500,"message":"Cannot read properties of undefined (reading 'url')","name":"TypeError","stack":["at Object.hello (file:///path/to/file.ts:9:21)"]}

When I log rev - it's undefined.

rev.response.clearCookie('authToken') not clear the cookie

when I used rev.response.clearCookie('authToken') to clear the cookie in the browser, it didn't work.

this is what worked for me :

return rev.response
.cookie("authToken", ``, {
        httpOnly: ['production', 'prod'].includes(process.env.NODE_ENV)
          ? true
          : false,
        maxAge: 0,
        encode: true,
        secure: ['production', 'prod'].includes(process.env.NODE_ENV)
          ? true
          : false,
      })
  .status(200)
  .send({
      message: 'Déconnecté avec succès.'
  });

Broken badge

Happy new year and thanks a lot for this amazing framework!

So, noticed this small badge broken at the documentation link:

IMG-20230102-WA0044

No export member 'TWrapMiddleware'

Just installed deno (version 1.13.0) on a new VM, made a test folder, created an app.ts file and copied the first example from 'Usage' section in the Nhttp documentation to it. When I run it with the following command:

deno run --unstable --allow-net --allow-read app.ts

I get the following error:

error: TS2305 [ERROR]: Module '"https://deno.land/x/[email protected]/src/types.ts"' has no exported member 'TWrapMiddleware'.

Please let me know if I'm doing something wrong.

Using https and Letsencrypt certificate problem.

Hi

I'm having a problem getting HTTPS to work. I'm sure I'm doing something wrong. The app just exits, and does not continue listening.

I normally use NginX Reverse Proxy manager to access the deno web app.
I now have a scenario where I have to run the web app and listen on port 443, and use a Lets Encrypt certificate.

I created a Debian VM on Digital Ocean and use Certbot to get and renew the certificate for api.notrealname.com (not the actual domain name).
The cert and key get stored at the following locations:
"cert": "/etc/letsencrypt/live/api.notrealname.com/fullchain.pem",
"key": "/etc/letsencrypt/live/api.notrealname.com/privkey.pem",

I've created the following test app:

import nhttp from "https://deno.land/x/[email protected]/mod.ts";
import settings from "./settings.json" assert { type: "json" };

const app = nhttp();

app.get("/", () => {
   return "Hi";
})

app.listen({
   port:443, 
   cert: settings.cert, 
   key: settings.key, 
   alpnProtocols: ["h2", "http/1.1"]
});

The settings.json file looks like this:

{
	"cert": "/etc/letsencrypt/live/api.notrealname.com/fullchain.pem",
	"key": "/etc/letsencrypt/live/api.notrealname.com/privkey.pem",
}

Build errors because of unpinned esm.sh version

In my build I get this error message from time to time though I'm using a deno.lock:

The source code is invalid, as it does not match the expected hash in the lock file.
  error: The source code is invalid, as it does not match the expected hash in the lock file.
    Specifier: https://esm.sh/[email protected]
    Lock file: /app/packages/backend/deno.lock

All my dependencies are pinned to fixed versions and esm.sh deps are also pinned to fixed esm.sh build versions.
I think the unpinned Version error comes from a transitive dependency of nhttp. -> https://github.com/nhttp/nhttp/blob/master/lib/class-validator.ts#L4C34-L4C34

I think the best way to fix that is to also pin the esm.sh version in your deps.
Further info is at https://esm.sh in docs and faq section, look for The source code is invalid,...

zod declaration and validation [idea / feature request]

Are there any plans or considerations to introduce zod as first class validator for nhttp?

Honestly, I have to say that I've never used zod before, but it looks very promising to me because you have type safety at both runtime and type level.

Currently one has to define the schema once for the validation at runtime, which one can also use for the generation of the OpenApi Spec.
And a second time for the type safety, to be able to continue working with the parsed body.

Controller method decorator doesn't seem to work

Hi there,

I wanted to check nhttp out to replace my app that is currently using Oak..

However i have a major issue using the controller decorators..

image

I navigated through the code and try to understand why,

im using one of the example code :

@Controller("/user")
class UserController {
  private readonly service = new UserService();

  @Get("/")
  findAll(rev: RequestEvent) {
    return this.service.findAll();
  }

  @Get("/:id")
  findById(rev: RequestEvent) {
    const params = rev.params;
    return this.service.findById(params.id);
  }
}

My deno version :

deno 1.41.0 (release, x86_64-pc-windows-msvc)
v8 12.1.285.27
typescript 5.3.3

Unsafe JSX rendering allows XSS exploitation

Greetings, and thanks for this lib :)

The current JSX rendering in the project allows unescaped HTML content to be injected, leading to a potential Cross-Site Scripting (XSS) vulnerability. This can be demonstrated using the following code snippet:

const XSS = () => <div>{"<script>alert(1)</script>"}</div>;

Expected Behavior:
The rendering of JSX should automatically escape HTML content within curly braces to prevent untrusted content from being interpreted as HTML.

Potential Impact:
This vulnerability exposes the application to XSS attacks, allowing malicious users to execute arbitrary scripts within the context of the application, compromising user data and security.

I would gladly work on that issue if you allow me.

Using socket.io with nhttp

Socket.io now work with deno. See https://socket.io/blog/socket-io-deno/
I am having some trouble with my syntax, trying to make it work with nhttp

import { NHttp, Router } from 'https://deno.land/x/nhttp/mod.ts';
import staticFiles from 'https://deno.land/x/static_files/mod.ts';
import Surreal from "https://deno.land/x/surrealdb/mod.ts";
import { Server } from "https://deno.land/x/socket_io/mod.ts";

const settings = JSON.parse(Deno.readTextFileSync('config.json'));
console.log(settings);

const io = new Server();
const db = new Surreal('http://127.0.0.1:8000/rpc');

// Signin as a namespace, database, or root user
await db.signin({
   user: 'root',
   pass: 'root',
});

// Select a specific namespace / database
await db.use('test', 'test');

const app = new NHttp();
app.use(staticFiles('public'));
app.use(io.handler());


app.get('/audit', ({ response }) => {
  const file = Deno.readTextFileSync('./public/auditgui.ps1');
  response.type('application/txt');
  response.header({
    'Content-Disposition': `attachment; filename="auditgui.ps1"`,
  });
  return file;
});

app.get('/', (rev) => {
  return rev.response.send('hello');
});

 io.on("connection", (socket) => {
  console.log(`socket ${socket.id} connected`);

  socket.emit("hello", "world");

  socket.on("disconnect", (reason) => {
    console.log(`socket ${socket.id} disconnected due to ${reason}`);
  });
});
 
 app.listen({ port: 3000, alpnProtocols: ['h2', 'http/1.1'] }, () => {
   console.log('> Running on port 3000');
 });

serve static example not working

Hi, I'm interested in developing APIs with deno but not with the plain oak but with a more opinionated way.

I try to reproduce the serve static example from: https://github.com/nhttp/nhttp/blob/master/examples/serve-static.ts

Here is my code:

import { NHttp } from "https://deno.land/x/[email protected]/mod.ts";
import staticFiles from "https://deno.land/x/[email protected]/mod.ts";

const app = new NHttp();

app.use("/", staticFiles("public"));
// app.use(staticFiles("public"));

app.listen(3000, () => {
  console.log("> Running on port 3000");
});

Everything I get if I go to http://localhost:3000/ is:
{"status":404,"message":"Route GET/ not found","name":"NotFoundError"}

Maybe I'm doing it wrong or was there a bug introduced?

File Upload ...

Hi

I feel like such a noob. I'm having trouble saving an uploaded file to disk.
The route looks like this:

app.post("/upload2", multipart.upload(({ name: "uploaded" })), async (rev) => {
  console.log(rev.file.uploaded);  // Shows file info 
  console.log(rev.body);  // Shows other fields
  const fileLocation = './uploaded';
  const filename = (rev.file.uploaded.name);
  const fullPathName = `${fileLocation}/${filename}`
  await Deno.writeFile(fullPathName, rev.file.uploaded);
  return "success upload file";
});

I use curl to upload a file and a field:

curl -v -F ttt=1234 -F uploaded=@./test.txt http://localhost:8000/upload2

I get the following error:
{"status":500,"message":"expected typed ArrayBufferView","name":"TypeError","stack":["at Array. (file:///root/test/app.js:119:14)"]}(base)

It seems like I need to take some buffer and write it to disk. Just not sure about the syntax.
Can you please guide me in the right direction?

Server Sent Event (SSE) helper

I would be nice to have a server sent event helper that passes control to a handler.
The sent event helper must be able to detect when the client drops/closes the connection, then drops the handler for that connection and not give an error, stating that a message was trying to be sent to a client connection that does not exist anymore.
A simple example using the native Deno http can be found at https://crux.land/61HZ4a

WebSocket example not working

Hi! I'm trying to run the websocket example (the chat application), and I have the following code:

index.html:

<!DOCTYPE html>
<html>

<head>
    <title>Hello Chat</title>
    <script>
        window.onload = function () {
            const ws = new WebSocket("ws://localhost:8001/ws");
            const chat = document.getElementById("my_chat");
            const form = document.getElementById("my_form");
            const message = document.getElementById("my_message");
            ws.onmessage = (e) => {
                chat.innerHTML += "<b>Friend: </b>" + e.data + "<br/>";
            }
            form.onsubmit = (e) => {
                e.preventDefault();
                if (!message.value || ws.readyState !== 1) {
                    return;
                }
                ws.send(message.value);
                chat.innerHTML += "<b>Me: </b>" + message.value + "<br/>";
                message.value = "";
            }
        };
    </script>
</head>

<body style="width: 80%; margin: auto">
    <h1>Simple Chat App</h1>
    <hr />
    <div id="my_chat"></div>
    <form id="my_form">
        <input id="my_message" placeholder="message" />
        <button type="submit">SEND</button>
    </form>
</body>

</html>

main.ts:

/* Simple realtime ChatApps */

import nhttp, { Handler, HttpError } from "https://deno.land/x/[email protected]/mod.ts";

const port = 8001;

const html = await Deno.readTextFile('./index.html');

const wsHandler: Handler = ({ request }) => {
    if (request.headers.get("upgrade") != "websocket") {
        throw new HttpError(400, "Bad Websocket");
    }
    const { socket, response } = Deno.upgradeWebSocket(request);
    const channel = new BroadcastChannel("chat");
    socket.onmessage = (e) => channel.postMessage(e.data);
    socket.onclose = () => channel.close();
    socket.onerror = () => channel.close();
    channel.onmessage = (e) => socket.send(e.data);
    return response;
};
const htmlHandler: Handler = ({ response }) => {
    response.type("html");
    return html;
};

const app = nhttp();

app.get("/", htmlHandler);
app.get("/ws", wsHandler);

await app.listen(port, (err, info) => {
    if (err) {
        console.error(`ERROR: ${err.message}`);
        Deno.exit(1);
    }

    console.log(`Running on port ${info.port}`);
});

Whenever I run the example with deno run -A main.ts, I get an error Firefox can't establish a connection to the server at ws://localhost:8001/ws in Firefox, and WebSocket connection to 'ws://localhost:8001/ws' failed: in Chromium. Any leads would be appreciated.

`rev.request` not 100% the original one

Body of the rev.request counted as consumed.
This is not a big deal, but it can block to use libs, which expects body as stream to perform .json() (for example).

For example, bot framework https://grammy.dev/ has a webhook handler, that can accept Request and do the work. But with nhttp it is not possible. There is only option to make a special adapter for grammy.

Connection abortion when returning void

Returning Promise<void> should response with an empty body.

My code:

@Controller("/entity")
export class MyController {

  @ApiParameter(paramId)
  @Delete("/:id")
  @Status(204) // same with 200
  deleteSomeEntity(rev: RequestEvent) {
    const { id } = rev.params;
    return doDelete(id);
  }
}

const doDelete = (_id: number): Promise<void> => {
  return Promise.resolve();
};

Request to /entity/1337 results in http: error: ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) while doing a DELETE request to URL: http://localhost:4001/api/entity/1337

Awaiting the promise and explicitly returning null works as expected, e.g. with return doDelete(id).then(() => null).
Returning new Response(null, { status: 200 }); also works.

I think 'void' should be translated to an empty body.

Please add support for AJV validator.

Hello Sir,
Please add support for AJV validator. I have some api that use AJV validator and I want to migrate to Nhttp but make change to use Zod is difficult.
Thanks

When will vuejs ssr support be ready ?

Hello, I'm doing VueJS on the front end and I'm looking for a way to build a complete application without making a separate API and separate VueJS frontend. When will vuejs ssr support be ready? Thanks a lot. I currently use nhttp as a separate api and a second vuejs project as a frontend and I feel exhausted working on both at the same time.

Serve static fail

Hi!

I used your example at: https://github.com/nhttp/nhttp/blob/master/examples/serve-static.ts
... and everything works fine.

Снимок экрана от 2021-07-06 13-16-02

problem

But as soon as I create a folder CSS and in the html document specify the path - everything stops working!

my example

const app = new Application()

app.use('/', statics('static'))

app.get('/', function index(response) {
    return response.send('./static/index.html')
})

app.listen(8080, () => {
    console.log('!')
})

Спасибо!

Use StreamResponse from worker-tools with nhttp, without blocking further requests

I'm trying to use the StreamResponder from worker-tools (https://workers.tools/) with nhttp, but it blocks any further requests.

My aim, i the end, is to have an elegant, easy, short way to stream messages to the browser using Server Sent Events (SSE), when I change a global variable or use BroadcastChannel (that I'm also struggling with) to send a new message. I specifically want to use SSE and not web-sockets.

This is example code that I use for testing:

import nhttp from "https://deno.land/x/nhttp/mod.ts";
import * as shed from 'https://ghuc.cc/worker-tools/shed/index.ts'
import staticFiles from 'https://deno.land/x/static_files/mod.ts';

const app = nhttp();
app.use(staticFiles('public'));

const message = 'Hi there';

async function* sse() {
   while (true) {
      await new Promise(r => setTimeout(r, 1000));
      yield `data: ${message}\n\n`;
   }
}

app.get('/sse', async (rev) => {
   console.log('connected')
   rev.respondWith(new shed.StreamResponse(sse(), {
      status: 200,
      headers: new Headers({
         'Connection': 'Keep-Alive',
         'Content-Type': 'text/event-stream',
         'Cache-Control': 'no-cache',
         'Keep-Alive': `timeout=${Number.MAX_SAFE_INTEGER}`,
      })
   }))
});

const options = {
   port: 443,
   certFile: "/etc/letsencrypt/live/api.mytest.com/fullchain.pem",
   keyFile: "/etc/letsencrypt/live/api.mytest.com/privkey.pem",
   alpnProtocols: ["h2", "http/1.1"]
}

app.listen(options, (err, opts) => {
   if (err) throw err;
   console.log("Running on server " + opts.port);
});

I then call this from the browser/html with:

      const evtSource = new EventSource('sse');
      evtSource.onmessage = async (event) => {
         console.log(event)
      };

[question] zod validation/transform and openApiDoc from zod spec definition

I am trying to use the zod validation in a holistic approach. For this the body should be validated and transformed. And from the same definition the swagger spec should be generated. Currently there are some code places in my project that need to be maintained redundantly (API spec request and response and typescript types of DTOs). I am trying to avoid this by using the zod definition as a single source of truth. I have two questions about this.

  1. I'm validating the request body with zod. This works, but I wonder if there is a way to remove the additional properties already with the validate. Otherwise I can always call zod's parse in the controller function. Then the validate annotation is no added value for me here. Or am I missing something?
import { RequestEvent } from "nhttp";
import { Controller, Post } from "nhttp_controller";
import { Validate, z } from "nhttp_zod";

const User = z.object({
  username: z.string(),
  password: z.string(),
  user_info: z.object({
    name: z.string(),
    address: z.string(),
  }),
}).strip(); // allow additional properties but strip them away

@Controller("/user")
export class TestUserController {
  @Validate(User)
  @Post("/")
  save(rev: RequestEvent) {
    console.log(`created user: ${JSON.stringify(rev.body)}`)
    const user = rev.body;
    // const user = User.parse(rev.body);
    return user;
  }
}

Request with following payload, with only validate, additional properties are not stripped away. With additional parse they are:

{
  "username": "user1",
  "password": "password1",
  "user_info": {
    "name": "User 1",
    "address": "Address 1"
  },
  "ffo": "bar" // this property is not stripped away
}
  1. I also try to generate a swagger spec with nhttp_swagger from the zod definition. That works great (for example with this library @anatine/zod-openapi), but I'm not sure, if and how I can pass the schema down to swagger.
    Is there a way to do this? Maybe like this?
import { generateSchema } from "npm:@anatine/zod-openapi";

@ApiRequestBody({
  description: "endpoint for xy",
  required: true,
  schema: generateSchema(User),
})
@GET("/xy")
myFunction() {}

btw: I think there is a problem with the import via default in your example of the lib/zod-validator.ts. It fails with Unable to resolve signature of method decorator when called as an expression.
https://github.com/nhttp/nhttp/blob/e5943f218a8909dbb8da2d41e8516e45a4181d6e/examples/zod-validator.ts
Using it with a named import works as expected.

RequestEvent is undefined when using controller (follow up)

I created an issue regarding this - #47

However, when I am trying to do this:

@Controller("/")
class RootController {
  @Get("/")
  get_root({ response: res }: RequestEvent) { 
    return res.status(200).json(<TResponse>{
      status: 200,
      message: "Welcome!",
      data: { }
    });
  }
}

When I navigate to / - I get this:

{"status":500,"message":"Cannot destructure property 'response' of 'undefined' as it is undefined.","name":"TypeError","stack":["at Object.get_root (file:///Y:/Projects/catgirls/webhook/controllers/RootController.ts:16:24)"]}

If I add the Status decorator, it works fine.

I believe it should work regardless as I am setting the status using res.status?

flash seems to be broken in 1.2.13

App with flash: true do not serving and finished after start. Also, it calls listen callback twice.
The same example without flash options works as expected.

import nhttp from "https://deno.land/x/[email protected]/mod.ts";

const app = nhttp({ flash: true });

app.get("/", () => {
  return new Response("Hello, World !!");
});

app.listen(8220, () => {
  console.log("> Running on port 8220");
});

Error output:

E:\..\ts\test > deno run -A test16.ts
> Running on port 8220
> Running on port 8220
E:\..\ts\test >

deno 1.33.1 (release, x86_64-pc-windows-msvc)
v8 11.4.183.1
typescript 5.0.3

request.body breaks for large bodies(?)

For some reason, the automatic request body parsing doesn't work for the following snippet. request.json() functions normally.

The JSON body being sent is ~1.3mb of image data encoded as base64 along with a couple of other fields.

app.post("/file", async ({ body, response, headers, request }) => {
        console.log(await request.json()); // correct body
        const token = headers.get("Authorization");
        const [msg, result] = await checkToken(token);
        if (msg) return error(response)(msg);

        console.log('upload', body); // upload {}

        const uuid = crypto.randomUUID();
        const type = headers.get("Content-Type");
        if (!type) return error(response)("Content type of file must be specified!");

        const metadata = body.metadata ? JSON.stringify(body.metadata) : undefined;

        await db.put(["files", uuid], {
            uploader: result!.username,
            data: body.contents,
            metadata,
            type
        });
        return { uuid };
    })

Error after deno upgrade to 1.21

Getting the following error after upgrading deno to 1.21:

TS2339 [ERROR]: Property 'serveHttp' does not exist on type 'typeof Deno'.
      const httpConn = Deno.serveHttp(conn);
                            ~~~~~~~~~
    at https://deno.land/x/[email protected]/src/nhttp.ts:315:29

problem with CORS in production

Hello, I have had a problem for a while with an API that I built with NHttp and Nodejs which is running in production.
Every time the spa vuejs frontend hosted on cloudflare page sends a request to the api after a certain time of inactivity (8hour...) the frontend request does not reach the server and I often get errors CORS in the browser console.

Screenshot from 2023-10-23 08-23-48

Please add support for AJV validator.

Hello Sir,
Please add support for AJV validator. I have some api that use AJV validator and I want to migrate to Nhttp but make change to use Zod is difficult.
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.