nanoexpress / legacy

[Deprecated] Nano-framework for Node.js. Use PRO version
https://nanoexpress.js.org
Apache License 2.0
107 stars 13 forks source link

Question: No CommonJS for the simple version? #94

Closed dnohr closed 4 years ago

dnohr commented 4 years ago

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.

dalisoft commented 4 years ago

It is supported, exactly it is main file is CommonJS

dalisoft commented 4 years ago

See https://unpkg.com/browse/nanoexpress@2.0.1/package.json and auto-build this file https://unpkg.com/browse/nanoexpress@2.0.1/build/nanoexpress.js

dalisoft commented 4 years ago

Which error do you get when you want use as CommonJS?

dnohr commented 4 years ago

You're right, CommonJS is working! I just didn't see any mention of it in the documentation, which is why I asked.

Is serveStatic also part of the CommonJS? I'm getting following error when trying to include it: Error: Cannot find module 'nanoexpress/cjs/static' const staticServe = require('nanoexpress/cjs/static');

It's from following example: https://nanoexpress.js.org/routes/static-serve

Thanks.

dalisoft commented 4 years ago

No, it’s not a part of cjs, it’s my typo in docs. I will fix as soon as i can get time

dalisoft commented 4 years ago

You trying to use syntax like PRO version, please see this example. In simple version there app.static method. Easy and built-in