Update on ✨Ramen 🍜✨ A new JavaScript Framework!
Armaan Gupta
Posted on December 28, 2022
Brief about what it is:
You can read the first Article I wrote about Ramen if you want to, But basically it's a framework which I'm working on for making backend APIs. And for now I'm just trying to re-write the Express.js code.
So in the past few hours I've achieved a lot of new developments in the codebase which are mentioned below
Done:
- [ x ] Initialize the project
- [ x ] Create a request class
- [ x ] Create a server class
- [ x ] add a test file
- [ x ] Create a response class
- [ x ] Create a middleware system
- [ x ] Add query parameters
- [ x ] add respond features in the response class
TODO:
- [ ] plan future features
- [ ] think about database connectivity
so basically I was able to add the request object, the response object and a lot of different stuff. So basically you can now go to the url http://ip:addr/foo/bar and if you have a route defined as /foo/:x
you can get the value of x via Request.params.x
, And not just this You can also get the query parameters which means You can go to /foo/bar?a=b
in this case the route parameter x
is bar
and the query parameter a
is b
. And you can also write responses with different status codes!
From that I mean you can just do Response.write({'Error': 'Auth failed 💔'}, 401)
and it will send a response to the corresponding request with a status code of 401 and a json data of the following. And it automatically detects the type of data you are trying to send, Which means that you can do Response.write('<h4>Hey my Content-Type is "text/html"</h4>', 200)
and it will send a text/html type response with a status code of 200 (which if you don't specify it's going to fallback to 200 anyways.)
Now the future plans If I think can be the following
- Adding cookies
- Adding a view engine
- Sending file type responses
Although I'm still trying to figure out what else am I supposed to add. Let me know in the comments below for what are the different stuffs I'm supposed to add to this framework!
Posted on December 28, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.