This is a Deno runtime REST API Tool that provides a simple way to create RESTful APIs with folder-based routing. The library allows you to easily organize your API endpoints and handle requests with ease.
- Folder-based routing
- Easy to use request handlers
- Support for nested routes
- Built-in method handling (GET, POST, etc.)
- Simple and clean code structure
To use this Tool, you need to have Deno installed on your machine. You can download it from Deno's official website.
-
Clone this repository to your local machine:
git clone https://github.com/tahsinkoc/elentis.git cd elentis
-
Create your API structure in the api folder. Each folder can have an index.ts file that exports a request handler function.
-
Start the server
deno run --allow-net main.ts
-
Acces the API endpoints.
/weather /weather/city
Here’s a simple example of how to set up an API endpoint:
// api/weather/index.ts
import { getWeather } from "../../components/CreateWeather.ts";
export default function GET() {
const weather = getWeather();
return new Response(JSON.stringify(weather), {
'headers': {
'Content-Type': 'application/json'
},
status: 200
})
}
export const method = 'GET';
To run the tests, use the following command:
deno test --allow-read --allow-net
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.