Requeriments:
system | compiler | extra |
---|---|---|
linux | g++ | -pthread flag |
- now you can render cpp code embedded in html files
- add: post, put, deletex, patch, head, options, link, unlink and purgue with x-www-form-urlconded, geturl, plain/text params each one of them
- added POST and PUT routes with x-www-form-urlencoded and plain/text
$ git clone https://github.com/scyth3-c/Magnetar.git
$ git submodule init
$ git subodule update
make:
$ cd magnetar-core
$ make
$ ./binary
all examples work
well, I wanted to make public the whole process/growth of this project, it is a web server in c++ whose requirements are to have g++ and linux only, currently, only attends GET and others requests but in the future I will expand little by little, it has several functions to make it more familiar as other web servers such as express in Node.js, it has a familiar syntax and I plan to insert existing modules that I uploaded previously as "addons" but I will try as much as possible not to add things to it. as much as possible not to add things that require something else like curl etc. to make it easier to use, here below you will find some screenshots of how it works. documentation is in process and if you want to collaborate do it without any fear, you can talk to me directly, my contact information is at at bohorquez.tech
the functions passed to the routes as the parameters to HEADERS and JSON are Infinite!!! the best way to learn is by testing, you can compile the examples with g++
you can see that it's not so wordy, which is the point of this project, but I still have to improve some things... well let's take a look!
the parameters are quite flexible, I have inserted several paths for the sake of convenience
implement callbacks functions to the response methods and like a normal lambda function get its environment by reference by adding & between the [] to access the entire scope
there are also middlewares, functions that we can add to control the route, they are infinite you can add as many as you want but you must add in next() to get to the next function or it will return that one.
Files, you can send the content of files directly
but there are things to improve, for example json processing, it is still incomplete.
there are still many other functions like the headers or the return system, so I recommend you to take a look at the examples
idle
RAM | CPU | read / write |
---|---|---|
2 MB | 0.0 | N/D-N/D |
responding
RAM | CPU | read / write |
---|---|---|
2MB | 0.0 | N/D-N/D |
Español
bueno, queria hacer publico todo el proceso/crecimiento de este proyecto, se trata de un servidor web en c++ cuyos requisitos son tener g++ y linux nada mas,actualmente, solo atiende peticions GET pero en en futuro ire ampliando poco a poco, tiene varias funciones para que sea mas familiar como otros servidores web como express en Node.js, tiene una sintaxis familiar y planeo inscrustarle modulos ya existentes que subi anteriormente como "addons" pero tratare lo mas posible de no agregar cosas que requieran de algo mas como curl etc. para que sea mas facil de usar, aqui abajo econtraran algunas capturas de como funciona, la documentacion esta en proceso y si quieres colaborar hazlo sin miedo alguno, puedes hablar conmigo directamente, mi informacion de contacto esta en bohorquez.tech