Skip to main content

An object-oriented efficient MVC and REST framework

This package works with Cloudflare Workers, Deno
This package works with Cloudflare Workers
This package works with Deno
JSR Score
94%
Published
2 weeks ago (0.2.4)

An object-oriented efficient MVC and RESTful framework

This project is rewritten based on the architecture of Project CandyJs

Quick start

CandyJs application start with an entry file

import type HttpRequest from '@candy/framework/http/HttpRequest';
import Main from '@candy/framework';
import Application from '@candy/framework/rest/Application';
import HttpResponse from '@candy/framework/http/HttpResponse';

const app = new Application({
    id: 'rest',
    debug: true,
});

app.get('/', async (_request: HttpRequest) => {
    return HttpResponse.fromText('Hello, world!');
});

app.get('/user/{id}', async (_request: HttpRequest, parameters: any) => {
    return HttpResponse.fromText('User ' + parameters.id);
});

const main = new Main(app);
main.listen({
    port: 2333,
});

Add Package

deno add jsr:@candy/framework

Import symbol

import * as framework from "@candy/framework";

---- OR ----

Import directly with a jsr specifier

import * as framework from "jsr:@candy/framework";