node.js - Getting the Server.serve status code using node-static in Typescript -
i'm trying write of node-static example code in typescript , i'm getting error
property 'status' not exist on type 'error'
here code error
import * server 'node-static'; import * http "http" var fileserver = new server.server('./images'); http.createserver(function (request, response) { request.addlistener('end', function () { var callback: server.callback; callback = function (e: error) { if (e && (e.status === 404)) { // error in line fileserver.servefile('/not-found.html', 404, {}, request, response); } }; fileserver.serve(request, response, callback) }).resume(); }).listen(8080);
error has type string , stacktrace, reason typescript error clear.
question how status code.
the original javascript code here
looks @types
node-static
wrong. link
especially because callback
function can have res
object.
you can fallback any
Comments
Post a Comment