
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
teys-rest is a wrapper around restify to quickly create REST API servers.
Use Typescript and annotations you can create your controllers and expose only the methods you want.
It helps you focus on your business code so you don't have to spend more time on setting up your server.
teys-rest as two approach of quick api server:
api-serverspa-severThe classic approach will allow you to create simple server like this:
import {ApiServer} from "teys-rest";
import {MyController1, MyController2} from "./controllers"
let api = new ApiServer();
api.start()
.then(() => api.registerControllers(MyController1, MyController2))
.then(() => console.log('server started'))
By default the server will run on port 3000 but it can be override by passing a ApiServerOptions object
By default all controllers will be registered under /api/v1/{controller}. All controllers must extends the RestController class in order to be properly register.
Each controller will have some properties injected via the teys-injector such as :
This approach is for people who wants to push a SPA with the Rest API code. It's build on top of the api-server approach
import path from "path"
import {SpaServer} from "teys-rest";
import {MyController1, MyController2} from "./controllers"
let spa = new SpaServer({
public: path.join(__dirname, "public")
});
spa.startWithControllers(MyController1, MyController2)
.then(() => console.log('server started'))
You can now specify the list of extensions of files that you want to expose
let spa = new SpaServer({
public: path.join(__dirname, "public"),
extensionsAllowed: ["png", "jpeg", "html", "js"]
});
If a list is provided via the property extensionsAllowed it will override the default list of extensions. So only those declared inside the array will be available.
The default value is : ["css", "html", "js", "png", "svg", "ico", "jpeg", "jpg", "woff", "woff2", "ttf"]
FAQs
Typescript REST server based on restify
The npm package teys-rest receives a total of 4 weekly downloads. As such, teys-rest popularity was classified as not popular.
We found that teys-rest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.