https://github.com/candyframework/candyjs
Node MVC 框架
https://github.com/candyframework/candyjs
javascript mvc-framework nodejs rest typescript
Last synced: 4 months ago
JSON representation
Node MVC 框架
- Host: GitHub
- URL: https://github.com/candyframework/candyjs
- Owner: candyframework
- License: mit
- Created: 2017-09-07T02:58:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-12-15T04:25:07.000Z (about 1 year ago)
- Last Synced: 2025-08-30T16:46:45.448Z (4 months ago)
- Topics: javascript, mvc-framework, nodejs, rest, typescript
- Language: TypeScript
- Homepage: https://candyframework.github.io/candyjs-guide
- Size: 1.64 MB
- Stars: 10
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGE_LOG.txt
- License: LICENSE
Awesome Lists containing this project
README
# An object-oriented efficient MVC and REST framework
[](https://www.npmjs.com/package/candyjs)
[](https://app.codecov.io/gh/candyframework/candyjs)
CandyJs is a new framework and it is not based on the third party framework
### Deno
Try https://jsr.io/@candy/framework
### Why CandyJs
- CandyJs implements the MVC (Model-View-Controller) architectural pattern
- Auto router system
- CandyJs is extremely extensible
- Practice with TypeScript
### DOC
- doc https://candyframework.github.io/candyjs-guide
- examples https://gitee.com/candyjs/candyjs-examples
- examples https://github.com/candyframework/candyjs-examples
### Version of Node.js
nodejs >= 10.0
### Quick start
```bash
# install
npm install -g @candyjs/cli
# run the command
candyjs-cli
```
### Hello world
CandyJs application start with an entry file
```javascript
// the entry file index.ts
import "@candyjs/tswrapper";
import CandyJs from "candyjs";
import App from "candyjs/web/Application";
new CandyJs(
new App({
"id": 1,
// define debug mode
"debug": true,
// define the base path of the running application
"appPath": __dirname + "/app",
}),
).listen(2333, () => {
console.log("listen on 2333");
});
```
### Alias
- @candy the directory where the Candy.ts file is located
- @app the base path of the running application
- @runtime the runtime path of the running application. Defaults to @app/runtime
### Application structure example
|- index.ts
|
|- node_modules
|
|- public
|
|- app
| |
| |-- controllers
| |
| |-- user
| | |
| | |-- IndexController.ts
| | |-- OtherController.ts
| |
| |-- goods
| | |
| | |-- IndexController.ts
| | |-- OtherController.ts
| |
| -- views
| |
| |-- user
| | |
| | |-- index.html
| | |-- other.html
| |
| -- goods
| | |
| | |-- index.html
| | |-- other.html
| |
| -- modules
| |
| |-- actives
| | |
| | |-- controllers
| | | |
| | | |-- IndexController.ts
| | |
| | |-- views
| | | |
| | | |-- index.html
| | |
| |
| -- runtime
|