3.0.0 • Published 6 years ago

htmlservercreator v3.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

HTMLServerCreator Rewrite

About

HTMLServerCreator is a node.js package that helps you creating a webpage with html files.

Examples

Creating a simple server.

const creator = require("htmlservercreator")
var app = require("express")()
var server = new creator.server(app, {port: 3000, emitrequestwhen404: false}) // Creating a server in port 3000

server.html("/", require("path").join(__dirname + "/index.html")) // localhost:300
server.html("/yeet", require("path").join(__dirname + "/yeet.html")) // locahost:3000/yeet
server.notfound(require("path").join(__dirname + "/404.html")) // 404

server.on("request", (route, req, res) => {
    console.log("Request to " + route)
})

server.listen().then((port) => { // Listen in the port that has been defined in server options
    console.log("Listening in port " + port)
})

Methods (<> = required, [] = optional)

creator.server(<expressApp (expressApp)>, options (Object)) Creates a HTMLServerCreatorServer server.html(<route (String)>, <path to html file (String)>) Serve a html file to server server.notfound(<path to html file (String)>) Define a html file to use when 404'd server.listen(use default port? (Boolean), if not to use default port, port (Number)) Make the server listen to a port

Test

$ npm test
3.0.0

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.0.0

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago