@15ms/server 中文文档教程
15ms-server
一个安全的可扩展单一所有者 API 服务器。
Getting Started
GET 用于访客访问。 POST 供所有者访问。
应验证和识别所有者访问权限。
Usage
npm install --save @15ms/server
const { Server } = require('@15ms/server');
const server = new Server({
secure: {
secret: 'your-secret'
},
applications: [
{ route: 'your-application-name', entry: 'entry-path-of-module' }
]
});
server.listen(8080);
curl http://localhost:8080/your-application-name/your-api-path
curl -X POST http://localhost:8080/your-application-name/your-api-path?hash=...
# also you can use @15ms/client to send request
15ms-server
A secure extensible single-owner API server.
Getting Started
GET for guest access. POST for owner access.
The owner access should be validated and identified.
Usage
npm install --save @15ms/server
const { Server } = require('@15ms/server');
const server = new Server({
secure: {
secret: 'your-secret'
},
applications: [
{ route: 'your-application-name', entry: 'entry-path-of-module' }
]
});
server.listen(8080);
curl http://localhost:8080/your-application-name/your-api-path
curl -X POST http://localhost:8080/your-application-name/your-api-path?hash=...
# also you can use @15ms/client to send request
更多