pablopunk / iga Goto Github PK
View Code? Open in Web Editor NEWZero config typescript/es6 server with the filesystem as the router
Home Page: https://pablopunk.com/iga
Zero config typescript/es6 server with the filesystem as the router
Home Page: https://pablopunk.com/iga
This cache will improve requests/sec by 10x based on my experiments
Make src/index.js
export the handler, no need to create the server in that library. This way I can use it as a middleware with any server, while keeping the ability to create a server inside src/cli.js
.
This will allow easier deployments, for example compatibility with now 2.0
lambdas.
NOTE: This means all manual cache mechanisms should be implemented where the server is implemented i.e the CLI. Http cache will still be managed in the library (manually) but for example handlers cache should be moved to the CLI. This affects #6
iga
command should do this
Use typescript
with sucrase if the file is ts
Right now both are the standard NodeJS http response and request objects. It's okay because people know how to use them and they're very well documented, but I would like to add a bit more functionality to both objects.
Some ideas:
request.query
: An object using require('url').parse
reponse.json
: Sets headers for JSON and accepts an object (that will get stringified
before sending)return object | string | number
: Instead of using the response
object, it would be usefull to just return a value. An object should be sent as a json, a string as text, and the number could just be the status code.Example:
// find-user.js
export default (req, res) => {
if (!req.query.id) {
return 403
}
const id = req.query.id
const user = getUserById(id)
if (!user) {
return 404
}
return { items: [user] }
// or res.json({ items: [user] })
}
https://nodejs.org/api/url.html#url_constructor_new_urlsearchparams_string
This would be a breaking change as the returned values need to be accessed by get
and set
, and right now it's just a plain object.
Nodemon is the dependency that makes iga
so heavy in size
Consider using chokidar
https://codeburst.io/dont-use-nodemon-there-are-better-ways-fc016b50b45e
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.