GreenShield Core is a API framework to build fast and reliables APIs with Node.js, with a simple syntax.
- Easy to read
- Open source Code
- Faster than other frameworks
Tech Used on the project
- [Javascript] - Programing language used
- [npm] - package manager
- [node.js] - evented I/O for the backend
Install the dependencies and devDependencies and start the server.
$ npm install --save GScore
a simple endpoint for standalone requisition is pretty easy to build and start coding inside, you just have to create a init point on your code and declare your route after it.
const Core = require("GScore").Core;
Core.init();
Core.get("/alone/get", function(req, res) {
res.end("Get");
});
Core.post("/alone/post", function(req, res) {
res.end("Post");
});
Core.start();
If you want to build a API, with the GreenShield framework you can code it like a list with a root endpoint.
const Core = require("GScore").Core;
Core.init();
Core.api("/api", [
{
url: "core",
get: (req, res) => {
res.end("GET API ROUTE");
},
post: (req, res) => {
res.end("POST API ROUTE");
}
},
{
url: "main",
get: (req, res) => {
res.end("ANOTHER GET API ROUTE");
}
}
]);
Core.start();
In this example we create 2 routes, "/api/core" and "/api/main".
const Core = require("GScore").Core;
Core.init();
Core.setEndpointConfig({ host: "0.0.0.0", port: 4000 });
//OR
Core.setEndpointConfig({ port: 4000 });
// You can change any of those values in this method
Core.setEndpointConfig({
host: "127.0.0.1",
port: 3000,
methods: ["GET", "POST", "PUT", "DELETE"],
rootRoute: "/"
});
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
- Ensure any install or build dependencies are removed before the end of the layer when doing a build.
- Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
- Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent. The versioning scheme we use is SemVer.
- You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
@ GreenShield Foundation