Nano-framework for Node.js
See more info at docs
[Deprecated] Nano-framework for Node.js. Use PRO version
Home Page: https://nanoexpress.js.org
License: Apache License 2.0
Nano-framework for Node.js
See more info at docs
6.7.2
to 6.8.0
.๐จ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
c5c7086
Fix: ignore aligning single line in key-spacing (fixes #11414) (#12652) (YeonJuan)9986d9e
Chore: add object option test cases in yield-star-spacing (#12679) (YeonJuan)1713d07
New: Add no-error-on-unmatched-pattern flag (fixes #10587) (#12377) (ncraley)5c25a26
Update: autofix bug in lines-between-class-members (fixes #12391) (#12632) (YeonJuan)4b3cc5c
Chore: enable prefer-regex-literals in eslint codebase (#12268) (่ๅฎ่ฐ็็ซ)05faebb
Update: improve suggestion testing experience (#12602) (Brad Zacher)05f7dd5
Update: Add suggestions for no-unsafe-negation (fixes #12591) (#12609) (Milos Djermanovic)d3e43f1
Docs: Update no-multi-assign explanation (#12615) (Yuping Zuo)272e4db
Fix: no-multiple-empty-lines: Adjust reported loc
(#12594) (Tobias Bieniek)a258039
Fix: no-restricted-imports schema allows multiple paths/patterns objects (#12639) (Milos Djermanovic)51f9620
Fix: improve report location for array-bracket-spacing (#12653) (Milos Djermanovic)45364af
Fix: prefer-numeric-literals doesn't check types of literal arguments (#12655) (Milos Djermanovic)e3c570e
Docs: Add example for expression option (#12694) (Arnaud Barrรฉ)6b774ef
Docs: Add spacing in comments for no-console rule (#12696) (Nikki Nikkhoui)7171fca
Chore: refactor regex in config comment parser (#12662) (Milos Djermanovic)1600648
Update: Allow $schema in config (#12612) (Yordis Prieto)acc0e47
Update: support .eslintrc.cjs (refs eslint/rfcs#43) (#12321) (Evan Plaice)49c1658
Chore: remove bundling of ESLint during release (#12676) (Kai Cataldo)257f3d6
Chore: complete to move to GitHub Actions (#12625) (Toru Nagashima)ab912f0
Docs: 1tbs with allowSingleLine edge cases (refs #12284) (#12314) (Ari Kardasis)dd1c30e
Sponsors: Sync README with website (ESLint Jenkins)a230f84
Update: include node version in cache (#12582) (Eric Wang)8b65f17
Chore: remove references to parser demo (#12644) (Kai Cataldo)e9cef99
Docs: wrap {{}} in raw liquid tags to prevent interpolation (#12643) (Kai Cataldo)e707453
Docs: Fix configuration example in no-restricted-imports (fixes #11717) (#12638) (Milos Djermanovic)19194ce
Chore: Add tests to cover default object options in comma-dangle (#12627) (YeonJuan)6e36d12
Update: do not recommend require-atomic-updates (refs #11899) (#12599) (Kai Cataldo)The new version differs by 29 commits.
9738f8c
6.8.0
ba59cbf
Build: changelog update for 6.8.0
c5c7086
Fix: ignore aligning single line in key-spacing (fixes #11414) (#12652)
9986d9e
Chore: add object option test cases in yield-star-spacing (#12679)
1713d07
New: Add no-error-on-unmatched-pattern flag (fixes #10587) (#12377)
5c25a26
Update: autofix bug in lines-between-class-members (fixes #12391) (#12632)
4b3cc5c
Chore: enable prefer-regex-literals in eslint codebase (#12268)
05faebb
Update: improve suggestion testing experience (#12602)
05f7dd5
Update: Add suggestions for no-unsafe-negation (fixes #12591) (#12609)
d3e43f1
Docs: Update no-multi-assign explanation (#12615)
272e4db
Fix: no-multiple-empty-lines: Adjust reported loc
(#12594)
a258039
Fix: no-restricted-imports schema allows multiple paths/patterns objects (#12639)
51f9620
Fix: improve report location for array-bracket-spacing (#12653)
45364af
Fix: prefer-numeric-literals doesn't check types of literal arguments (#12655)
e3c570e
Docs: Add example for expression option (#12694)
There are 29 commits in total.
See the full diff
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
app.setErrorHandler((err: any, req: HttpRequest, res: HttpResponse): any => {
const errMsg = globalVariables.SETTINGS.ENV === 'local' ? err.error.toString() : null;
const errStack = globalVariables.SETTINGS.ENV === 'local' ? err.error.stack.toString() : null;
console.error(errStack);
res.status(500);
res.send(
{
message: 'Server error',
errMsg,
errStack,
},
);
});
` app.post('/auth/google', async (req: any, res: any) => {
throw new Error('Invalid google login');
});
};`
(node:13708) UnhandledPromiseRejectionWarning: Error: Invalid google login
at F:\Dev\Rmi\Tm86\api-backend\src\routes\logincallbacks.routes.ts:8:11
at Generator.next (<anonymous>)
at F:\Dev\Rmi\Tm86\api-backend\src\routes\logincallbacks.routes.ts:8:71
at new Promise (<anonymous>)
at __awaiter (F:\Dev\Rmi\Tm86\api-backend\src\routes\logincallbacks.routes.ts:4:12)
at F:\Dev\Rmi\Tm86\api-backend\src\routes\logincallbacks.routes.ts:7:57
at handler (F:\Dev\Rmi\Tm86\api-backend\node_modules\nanoexpress\build\nanoexpress.js:1971:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at F:\Dev\Rmi\Tm86\api-backend\node_modules\nanoexpress\build\nanoexpress.js:1749:20
(node:13708) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13708) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
With not async methods work perfectly.
Is this even possible with nanoexpress?
On normal express, it was possible like this:
var app = require('express')();
var http = require('http').createServer(app);
var io = require('socket.io')(http);
http.listen(3000, () => {
console.log('listening on *:3000');
});
Thanks.
Related issue #158
When attempting to call app.publish('broadcast', 'test message');
after the app.ws is setup causes the application to silently crash/die.
I fight with Chrome hiding errors: https://stackoverflow.com/questions/60917740/chrome-developer-is-hiding-status-and-response
Is there any way how to turn a raw request and response logging in Nanoexpress?
Here's a demo file for this error. It's just lists the files of a directory
const path = require('path')
const fs = require('fs')
const nanoexpress = require('nanoexpress')
const util = require('util')
const fsReadDir = util.promisify(fs.readdir)
const app = nanoexpress()
const port = 4000
// list the files of `storage/media` directory
app.get('/', async (req, res) => {
let files = []
try {
files = await fsReadDir(path.resolve(__dirname, '../../storage/media'))
return res.send({error: false, files})
} catch (err) {
return res.send({ error: true })
}
})
// start server
;(async () => {
try {
await app.listen(port, '0.0.0.0')
} catch (err) {
console.error(err)
}
})()
The problem is that every time that i run and the server and send a GET /
request, the server throws these warnings
(node:5728) UnhandledPromiseRejectionWarning: Invalid access of discarded (invalid, deleted) uWS.HttpResponse/SSLHttpResponse.
(node:5728) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5728) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The problem happens when i call the fsReadDir
. If i move the res.send
before it, there wont be any warning.
Posting an invalid json body with Content-Type application/json cause request to hang for aprox 10 seconds before the socket is close and the following is written to the console
(node:25737) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token a in JSON at position 1
at JSON.parse (<anonymous>)
at body (/tmp/nanotest/node_modules/nanoexpress/build/nanoexpress.js:559:21)
at async /tmp/nanotest/node_modules/nanoexpress/build/nanoexpress.js:1659:11
(node:25737) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
Sample program:
const nanoexpress = require('nanoexpress');
const app = nanoexpress();
app.setErrorHandler((err, req, resp) => {
console.log(err);
resp.status(500).end(err.message);
});
app.setValidationErrorHandler( (err, req, resp) => {
console.log(err);
resp.status(500).end(JSON.stringify(err.errors));
});
app.post('/', (req, resp) => {
resp.send( "sdfsdfdsf");
});
app.listen(4002).catch((...args) => {
console.log(args)
});
Testing:
curl http://localhost:4002/ -H "Content-Type: application/json"-X POST --data-binary '{a}'
node examples/error-handler.js
> curl localhost:4000/nonexisting
curl: (52) Empty reply from serve
Also a bit weird that the function has signature
setNotFoundHandler(
notFoundHandlerCallback: (
res: HttpRequestBasic,
req: HttpRequestBasic
) => HttpRequestBasic
): nanoexpressApp;
when every other method follows the node convention with request, response
app.ws('/', (req, ws) => {
ws.end(3, 'Close message');
});
Visual Studio Code reports that ws is from the interface HttpResponse.
Hi, im trying to run handlebars(view engine) with nanoexpress, any recommendation?
Hi,
Any reason for not having CommonJS supported in the simple package? I think it would be easier to migrate from express if it's supported.
Thanks.
Hi there! First off I wanna thank you and Alex for these great projects. Performance is absolutely fantastic for a node.js server, easily beating Express 5x.
While integrating with Sapper (to perform server-side rendering) I ran into a number of issues I believe are bugs. Sapper uses an express middleware to run all the routing etc.
req.originalUrl
is unimplemented - https://expressjs.com/en/api.htmlstring
. I was able to fix this temporarily with Object.defineProperty
: Object.defineProperty(res, 'statusCode', { set: val => (res.rawStatusCode = val), });
. res.status
didn't work either and caused the same issue as setting res.statusCode
. I'm not sure whether rawStatusCode
actually does anything though. I couldn't find any good examples on setting the status code other than skimming https://github.com/dalisoft/nanoexpress/blob/master/src/proto/http/polyfill-chunks/status.js.app.use(sapper.middleware())
, but I had to do app.any(sapper.middleware())
with nanoexpress
, as the app.use didn't fire at all. Additionally, when using app.any
any app.use
s would still not fire: app.use((req, res, next) => console.log(req, res) || next());
before the app.any
wouldn't cause anything to log.I also found app.setErrorHandler
and app.setNotFoundHandler
a bit strange. It's nice and convenient but I can imagine it throwing express veterans off, especially given that app.use
doesn't seem to work.
I've been able to fix all of these in my application code, but it was time consuming to figure out what was going wrong. Given that these are all minor issues I figured it would be better to make a single issue. If you need any help with a test case let me know.
I realized uWebSockets: v0.15
header comes by default. It's a security bad practice to send this kind of information to client.
Hello!
I saw the benchmarks and it looks very promising. I'm thinking about using this library in a microservices project and I was wondering if http2 support is available. Thanks!
hello
there is no guide to use subscribe / publish in docs
how can we do that?
What version of nanoexpress are you using?
1.1.12
Context
I am wanting to validate the structure of the request that is being send to "/uploadSchema". After the validation errors are returned, an "UnhandledPromiseRejectionWarning" is showing in the terminal. The structure of the request is incorrect deliberately.
Request being sent
{
"schema": {},
"key": {} // uploadSchema expects a string
}
Expected request structure
{
"schema": {},
"key": "someSchemaName"
}
Your code
const nanoexpress = require('nanoexpress');
const app = nanoexpress();
const Ajv = require('ajv');
const ajv = new Ajv({
validateSchema: false,
allErrors: true,
jsonPointers: false,
ownProperties: true
});
app.post('/uploadSchema', {
schema: {
body: {
type: 'object',
properties: {
schema: { type: 'object' },
key: { type: 'string' },
},
required: ["schema", "key"]
},
response: false,
query: false,
params: false,
cookies: false
}
},
async (req, res) => {
res.send({status: 200})
});
app.setValidationErrorHandler((errors, req, res) => {
res.end('Validation errors, ' + JSON.stringify(errors));
});
app.listen(4000);
module.exports = app;
Response
Validation errors, {"type":"errors","errors":[{"type":"body","messages":["should be string"]}]}
After a few seconds the following was displayed in the terminal:
(node:16302) UnhandledPromiseRejectionWarning: Invalid access of discarded (invalid, deleted) uWS.HttpResponse/SSLHttpResponse.
(node:16302) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:16302) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:16302) UnhandledPromiseRejectionWarning: Invalid access of discarded (invalid, deleted) uWS.HttpResponse/SSLHttpResponse.
(node:16302) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
What results did you expect?
I expected there to be no UnhandledPromiseRejectionWarning. I am not sure if this is due to a mistake on my end; however, I see that a recent issue was closed which I believe covers the same issue.
1.14.2
to 1.14.3
.๐จ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
2019-06-06
The new version differs by 4 commits.
c68bd95
1.14.3
d79aa57
Update changelog
7179390
Use browser relative path algorithm for chunks (#2902)
b1df517
Add funding button
See the full diff
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
The following sample shows the problem
const nanoexpress = require('..');
const app = nanoexpress();
app.setErrorHandler( (err, req, res) => {
res.status(500);
res.end("Server error");
});
if(process.argv[2]==="middleware") {
app.use((req,res,next)=>{
console.log("in middleware");
next()
})
}
app.get('/*', (req, res) => {
req.nonExistingFunc();
res.end('hello world');
}).listen(4000);
when running without the arg middleware, the node process exits without handling the error in the errorHandler
When running through the middleware, node core dumps
Error: Returning from a request handler without responding or attaching an abort handler is forbidden!
terminate called without an active exception
[1] 27234 abort (core dumped) node examples/broken-error-handler.js middleware
Starting at June 1 2020 on project will be added ESM support, but does not remove CJS support and CJS/ESM support will be like PRO version
Update 1: Added note instead of table
Update 2: Update note
The bug is located in /src/handler/ws.js
The code fragment that causes the issue is this:
if (options.schema) {
if (typeof message === 'string') {
if (message.indexOf('[') === 0 || message.indexOf('{') === 0) {
if (message.indexOf('[object') === -1) {
message = JSON.parse(message);
}
}
}
The code will attempt to JSON.parse() a string like {keyWithoutQuotes:stringValueWithoutQuotes}
which is an invalid JSON object causing JSON.parse() to throw
How are headers added to static server and how do you combine the uWS example and the Static example without creating 2 separate servers? I've actually built an app with uWS.SSLApp and I was searching for zero-configuration NginX alternatives, which is how I arrived here thru the Web Frameworks Benchmarks.
I have a trouble with my POST JSON request: https://stackoverflow.com/questions/60763165/axios-post-stalled-in-chrome
It is CORS issue. How can I write OPTIONS handler with empty body? I tried this, but it did not help for chrome and it does not return anything to Postman until time out.
app.options('/v1/authorizeUser', async (req, res) => {
console.log("OPTIONS authorizeUser");
res.status(200);
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
return res;
});
I tried to use cors middleware but it had no effect
const cors = require('cors');
app.post('/v1/authorizeUser', cors(), async (req) => {
console.log("POST authorizeUser");
const { email, password } = req.body;
console.log(email);
return { status: 'Ok', body: req.body };
});
I was wondering if I can use Nanoexpress in cloud functions of firebase or lamda of aws.
Every method in API has this sequence: req, res but notFound handler has an opposite
errorHandlerCallback: (
err: Error,
req: HttpRequest,
res: HttpResponse
) => HttpResponse
validationErrorHandlerCallback: (
errors: validationErrors,
req: HttpRequest,
res: HttpResponse
) => any
type HttpRoute = (
req: HttpRequest,
res: HttpResponse,
next?: Function,
config?: object,
previousMiddlewareResult?: any
) => any;
notFoundHandlerCallback: (
res: HttpResponseBasic,
req: HttpRequestBasic
) => HttpRequestBasic
There is not much users yet, so you can break a backward compatibility and unify it.
Version 1.1.8
URL encoded www form data:
{"email":"[email protected]","password":"centrum"}:
console.log(req);
body: [Object: null prototype] {
'{"email":"[email protected]","password":"centrum"}': ''
}
Nanoexpress thinks that this is a key with empty value.
so this fails:
const { email, password } = req.body;
I have defined both error and not found handler:
app.setErrorHandler(
(err, req, res) => {
return res.send({
status: 'error',
status_code: 500,
message: 'oops'
})
}
);
app.setNotFoundHandler((res, req) => {
return res.send({ code: 404, message: 'You entered wrong url' });
});
This is the handler:
app.post('/bff/polls/:pollId/votes', auth.required, auth.cors, async (req, res) => { /* logic */});
I posted this URL:
http://127.0.0.1:3000/bff/polls/1e420fdqup/vote
And I received no response at all from server. There was a typo in URL, the correct address is:
http://127.0.0.1:3000/bff/polls/1e420fdqup/votes
It seems to be related to dynamic part of URL because I receive 404 error for this URL:
http://127.0.0.1:3000/v1/pols?obd=id&ps=10&lr=id:1e4h34qmef
with this handler:
app.get('/bff/polls/last', auth.optional, async (req, res) => { /* logic */});
I am getting the following errors:
(node:46753) UnhandledPromiseRejectionWarning: TypeError: schema is not a function
at uWS.HttpResponse.send (/Users/c.fernandez.traba/Development/Projects/Online%20Coaching%20API/plans/node_modules/nanoexpress/build/nanoexpress.js:866:18)
at /Users/c.fernandez.traba/Development/Projects/Online%20Coaching%20API/plans/node_modules/nanoexpress/build/nanoexpress.js:1779:20
at processTicksAndRejections (internal/process/task_queues.js:97:5)
when trying to use the following examples:
https://github.com/nanoexpress/nanoexpress/blob/master/examples/swagger-ui.js
https://github.com/nanoexpress/nanoexpress/blob/master/examples/schema.js
But probably the same is happening for any example where the schemas are set directly as a MW.
I am using node 14.0.0 but i have the same errors under node 10.16.0 and nanoexpress 2.0.1.
Is this documentation up to date: https://nanoexpress.js.org/schemas. ?
Thanks
1.14.6
to 1.15.0
.๐จ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
To keep alive project
Stargazers
twice#29
If you about this, then i keep using uWebSockets.js as base, if you want switch, see above
If you isn't Sponsor/Backer, see below
If you Sponsor/Backer, you will get access to new repository
express
?)Author keeps right of make repository private at any time
1.27.6
to 1.27.7
.๐จ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
2019-12-01
The new version differs by 4 commits.
c753a7f
1.27.7
1b8a3de
Update changelog
d5651be
Fix incomplete computed property deoptimization (#3267)
d7e3993
Update changelog
See the full diff
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
devDependency
@babel/core was updated from 7.5.5
to 7.6.0
.devDependency
@babel/preset-env was updated from 7.5.5
to 7.6.0
.๐จ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.
babel7 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
const html = require('ejs').renderFile(view, Object.assign({}, opts));
res.status(200);
res.setHeader('Content-Type', 'text/html; charset=utf-8');
return res.end(Buffer.from(html, "utf-8"));
(node:8243) UnhandledPromiseRejectionWarning: Invalid access of discarded (invalid, deleted) uWS.HttpResponse/SSLHttpResponse.
(node:8243) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
In the tests I did, sometimes the error appears and sometimes not, but only when using setheader, and only in google chrome.
Firefox tests did not result in the error.
1.18.0
to 1.19.0
.๐จ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 6 commits.
9af119d
1.19.0
b3f361c
Update changelog
456f4d2
Avoid variable from empty module name be empty (#3026)
17eaa43
Use id of last module in chunk as name base for auto-generated chunks (#3025)
871bfa0
Switch to a code-splitting build and update dependencies (#3020)
2443783
Unified file emission api (#2999)
See the full diff
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
Preflight options stopped working. When I invoke options method from postman (or chrome) I receive no data. I use cors per route feature as described here: https://nanoexpress.js.org/testing/known-bugs#cors-per-route-bug. I have created an cors origin function and I can see that it is being called.
I tried to remove all dependencies and create the most simple reproducible project: https://github.com/literakl/nano-options. There are two identical servers: nanoexpress and express. When I submit options method from Postman while express variant is running, I receive a response. Then I switch to nanoexpress variant and I receive no response at all.
Can you please tell me what is going on? I went through my changes and the code is identical and it used to work. The same versions are used as well. Is this bug? I lost one day trying to figure out the root cause with no luck. And it is strange that express works in the same scenerio. Thank you
HI,
I met a error while testing typescript project.
===========================================
node_modules/nanoexpress/nanoexpress.d.ts:166:20 - error TS2430: Interface 'nanoexpressApp' incorrectly extends interface 'TemplatedApp'.
Types of property 'listen' are incompatible.
Type '(port: number, host?: string | undefined) => Promise' is not assignable to type '{ (host: RecognizedString, port: number, cb: (listenSocket: us_listen_socket) => void): TemplatedApp; (port: number, cb: (listenSocket: any) => void): TemplatedApp; }'.
Types of parameters 'port' and 'host' are incompatible.
Type 'RecognizedString' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
166 export interface nanoexpressApp extends AppTemplatedApp {
~~~~~~~~~~~~~~
In my humble opinion, seems uWS's TemplatedApp interface had been changed and the nanoexpress.d.ts was not updated properly.
Could you check it?
I try to find some resources on this interesting library without luck. Even StackOverflow is empty. The documentation is written for seasoned NodeJS developers and I, as a newbie, cannot even start the server from command line. Is there any forum? Thanks
const nanoexpress = require("nanoexpress");
const app = nanoexpress();
app.get("/search", (req, res) => {
return res.send({ code: 200 });
});
app.listen(3001).then(() => console.log("Listening..."));
then curl http://localhost:3001/search
response looks like this:
โ curl http://localhost:3001/search
{"code":200}%
โ curl http://localhost:3001/search
{"code":200}%
โ curl http://localhost:3001/search
{"code":404,"message":"The route does not exist"}%
โ curl http://localhost:3001/search
{"code":200}%
โ curl http://localhost:3001/search
{"code":200}%
โ curl http://localhost:3001/search
{"code":200}%
โ curl http://localhost:3001/search
{"code":200}%
โ curl http://localhost:3001/search
{"code":404,"message":"The route does not exist"}%
โ curl http://localhost:3001/search
{"code":200}%
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.