Snapshot của remoteinterview/zero: 5.8k★ · JavaScript · Frontend. Zero is a web server to simplify web development.
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.
Features |
Installation |
Getting Started |
Examples |
Docs
Zero is a web framework to simplify modern web development. It allows you to build your application without worrying about package management or routing. It's as simple as writing your code in a mix of Node.js, React, HTML, MDX, Vue, Svelte, Python, and static files and putting them all in a folder. Zero will serve them all. Zero abstracts the usual project configuration for routing, bundling, and transpiling to make it easier to get started.
An example project with different types of pages, all in one folder:
Features
Auto Configuration: Your project folder doesn't require config files. You just place your code and it's automatically compiled, bundled and served.
File-system Based Routing: If your code resides in ./api/login.js it's exposed at http://<SERVER>/api/login. Inspired by good ol' PHP days.
Auto Dependency Resolution: If a file does require('underscore'), it is automatically installed and resolved. You can always create your own package.json file to install a specific version of a package.
Multiple Languages: Zero is designed to support code written in many languages all under a single project. Imagine this:
Exposing your Tensorflow model as a python API.
Using React pages to consume it.
Writing the user login code in Node.js.
Your landing pages in a mix of HTML or Markdown/MDX.
All under a single project folder as a single web application.
Play on Glitch
You can play with Zero without installing it locally. Click the button below:
Installation
You can install zero globally by:
npm install -g zero
Getting Started
Let's start by making a website that tells us server time.
First we need to create an API endpoint in Node.js to tell us time in JSON.
Create a new folder and add a new file time.js in that folder. In this file, export a function that accepts Request and Response objects (like Express):
// time.js
const moment = require("moment");
module.exports = (req, res) => {
var time = moment().format("LT"); // 11:51 AM
res.send({ time: time });
};
Once saved, you can cd into that folder and start the server like this:
zero
Running this command will automatically install any dependencies (like momentjs here) and start the web server.
Open this URL in the browser: http://localhost:3000/time
You just created an API endpoint 🎉:
Keep the server running. Now let's consume our API from a React page, create a new file index.jsx and add the following code:
// index.jsx
import React from "react";
export default class extends React.Component {
static async getInitialProps() {
var json = await fetch("/time").then(resp => resp.json());
return { time: json.time };
}
render() {
return <p>Current time is: {this.props.time}</p>;
}
}
This is a standard React component. With one additional hook for initial data population:
getInitialProps is an async static method which is called by zero when the page loads. This method can return a plain object which populates props.
Now go to this URL: http://localhost:3000/ and you should see the current server time rendered by React while fetch-ing an API endpoint you created earlier:
zero automatically bundles your code and supports server-side rendering. You don't need to fiddle with webpack anymore.
That's it! You just created a web application.
Supported Languages
Node.js (JavaScript & TypeScript)
React (JavaScript & TypeScript)
HTML
Markdown / MDX
Vue
Svelte
Python
Auto Dependency Resolution
If a file does require('underscore'), the latest version of that package is automatically installed from NPM and resolved.
But sometimes you want to use a specific version or a dependency from a private repository. You can do that by creating a package.json in your project folder and adding dependencies to it. Zero will install those versions instead.
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/remoteinterview/zero là nguồn chính thức.
remoteinterview/zero có bao nhiêu sao?
remoteinterview/zero có 5.8k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/remoteinterview/zero. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
remoteinterview/zero có phải mã nguồn mở không?
Có — remoteinterview/zero phát hành theo license Apache-2.0, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/remoteinterview/zero.
remoteinterview/zero còn đang phát triển không?
Commit gần nhất trên remoteinterview/zero là 2.7 năm trước (theo timestamp GitHub). Repo có 240 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
remoteinterview/zero là gì?
remoteinterview/zero (remoteinterview/zero) là dự án JavaScript trên GitHub. Theo mô tả gốc: Zero is a web server to simplify web development.
remoteinterview/zero so với các dự án Frontend khác thế nào?
remoteinterview/zero được TopGit xếp vào nhóm Frontend, với 5.8k sao GitHub và viết bằng JavaScript. Xem trang chủ đề Frontend trên TopGit để so sánh với các dự án tương tự theo số sao và mức độ hoạt động.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về zero?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về zero.