Được TopGit lập chỉ mục từ metadata GitHub: typestack/microframework có 73 sao, viết chủ yếu bằng TypeScript. [deprecated] Microframework is a simple tool that allows you to execute your modules in proper order, helping you to organize bootstrap code in your application.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Microframework is deprecated, please use routing-controllers instead!
Microframework is a simple tool that allows you to execute and configure your modules (called loaders) in a proper order,
helping you to organize bootstrap code in your application.
Usage
First, install microframework:
npm i microframework
Second, create a simple "loader" named expressLoader.
Loader is a place where you can configure all your modules during microframework bootstrap.
All loaders are executed one by one in a sequential order.
import { MicroframeworkSettings } from 'microframework';
export function expressLoader(settings: MicroframeworkSettings) {
// create express app
const app = express();
// register all routes, Routes are just routes that should be stored outside of this module
const routes: any = Routes;
Object.keys(routes).forEach(routePath => app.get(routePath, routes[routePath]));
// run application to listen on given port
app.listen(3000);
// your loader also can return a promise and microframework will wait for it in a proper order
}
Create app.ts and bootstrap a microframework and your express loader:
import { bootstrapMicroframework } from 'microframework';
import { expressLoader } from './expressLoader';
bootstrapMicroframework([expressLoader])
.then(() => console.log('Application is up and running.'))
.catch(error => console.log('Application is crashed: ' + error));
That's all. You can do same for other loaders.
Take a look on sample to understand better how concept of loaders and their bootstrapping in microframework.
Settings
You can specify additional options to microframework.
logo - Logo needs to be used before application launches. To use logo ansi-art node module should be installed.
showBootstrapTime - If set to true then framework shows how much time was spend to bootstrap microframework.
bootstrapTimeout - Number of milliseconds to wait before framework will bootstrap.
Example of using settings:
import { bootstrapMicroframework } from 'microframework';
import { expressLoader } from './expressLoader';
bootstrapMicroframework({
config: {
logo: 'MyApp',
showBootstrapTime: true,
bootstrapTimeout: 10,
},
loaders: [
expressLoader,
// ...
],
})
.then(() => console.log('Application is up and running.'))
.catch(error => console.log('Application is crashed: ' + error));
Sharing data across loaders
Sometimes few loaders need to communicate between each other and use shared data.
For such purpose you can store the data in settings object passed to each loader
and use stored data across all other loaders. For example:
import { MicroframeworkSettings } from 'microframework';
export function expressLoader(settings: MicroframeworkSettings) {
// create express app
const app = express();
// register all routes, Routes are just routes that should be stored outside of this loader
const routes: any = Routes;
Object.keys(routes).forEach(routePath => app.get(routePath, routes[routePath]));
// run application to listen on given port
app.listen(3000);
settings.setData('express_app', app);
}
And another loaders can use data this way:
import { MicroframeworkSettings } from 'microframework';
export function socketIoLoader(settings: MicroframeworkSettings) {
const io = io();
io.useExpress(settings.getData('express_app'));
}
Application Shutdown
In the case if you want to shutdown running application you need to do following:
import { bootstrapMicroframework } from 'microframework';
import { expressLoader } from './expressLoader';
bootstrapMicroframework({
config: {
logo: 'MyApp',
showBootstrapTime: true,
bootstrapTimeout: 10,
},
loaders: [
expressLoader,
// ...
],
})
.then(framework => {
// do something before shutdown
// and shutdown everything
return framework.shutdown();
})
.then(() => {
// now everything is turned off
})
.catch(error => console.log('Application is crashed: ' + error));
All loaders which use resources should release them, for example:
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/typestack/microframework là nguồn chính thức.
typestack/microframework có bao nhiêu sao?
typestack/microframework có 73 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/typestack/microframework. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
typestack/microframework có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho typestack/microframework. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
typestack/microframework còn đang phát triển không?
Commit gần nhất trên typestack/microframework là 6.0 năm trước (theo timestamp GitHub). Repo có 22 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
typestack/microframework viết bằng ngôn ngữ gì?
typestack/microframework chủ yếu viết bằng TypeScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
microframework có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về microframework.