Skip to content

Troll Server

Min Si Thu edited this page Jul 15, 2019 · 1 revision

Server in Troll Hunter

Troll Hunter version 1.3.0 supports web-server in troll-hunter.js by default. The web server is based on express.js. Anything that can be used with express.js can be used with troll-hunter.

npm install --save troll-hunter
let Server = require("troll-hunter/thServer");
let path = require("path");

Server.appDirectory(path.join(__dirname,"app"));

Server.LISTEN(3000,()=>{
    console.log("Server is listening at port 3000!")
})

appDirectory method is setting path for app. All files in that directory are set as server routes. LISTEN method is setting port for server.

Clone this wiki locally