typescript(translucid): fixed typos
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
6388e9cafb
commit
e3b8c17c56
|
@ -1,9 +1,9 @@
|
||||||
# Translucid
|
# Translucid
|
||||||
A simple node library to bind files to requests
|
A simple node.js library to bind files to requests
|
||||||
|
|
||||||
# Get started:
|
# Get started:
|
||||||
|
|
||||||
First you need to insall the package:
|
First you need to install the package:
|
||||||
```
|
```
|
||||||
npm install translucid --save
|
npm install translucid --save
|
||||||
```
|
```
|
||||||
|
@ -13,26 +13,26 @@ Then, you need to include it in your project:
|
||||||
const trans = require("translucid");
|
const trans = require("translucid");
|
||||||
```
|
```
|
||||||
|
|
||||||
To init your first server, call .QuickServer(port):
|
To create your first server, call ".QuickServer(port)":
|
||||||
```
|
```
|
||||||
trans.QuickServer(8000);
|
trans.QuickServer(8000);
|
||||||
```
|
```
|
||||||
|
|
||||||
The .QuickServer methode return many useful objects:
|
The ".QuickServer" method return many useful objects:
|
||||||
```
|
```
|
||||||
const {app,server,connect,translucid} = trans.QuickServer(8000);
|
const {app,server,connect,translucid} = trans.QuickServer(8000);
|
||||||
```
|
```
|
||||||
Connect is a promise that resolves when the server starts listening to the port:
|
"Connect" is a promise that resolves when the server starts listening to the port:
|
||||||
```
|
```
|
||||||
connect.then(() => {
|
connect.then(() => {
|
||||||
console.log("Listening on port 8000!");
|
console.log("Listening on port 8000!");
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
The translucid object can be used to make files bindings:
|
The translucid object can be used to make file bindings:
|
||||||
```
|
```
|
||||||
translucid.bind("/","client/index.html",true//use midleware,["myId"]);
|
translucid.bind("/","client/index.html",true//use midleware,["myId"]);
|
||||||
```
|
```
|
||||||
Then you can add midlewares like this:
|
Then you can add midleware like this:
|
||||||
```
|
```
|
||||||
translucid.use({
|
translucid.use({
|
||||||
name:"my midleware",
|
name:"my midleware",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "A simple node library to bind files to requests",
|
"description": "A simple node library to bind files to requests",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"-1/12\" && exit 1"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "github",
|
"type": "github",
|
||||||
|
|
Loading…
Reference in a new issue