3.0.0 • Published 5 years ago
simple-files-server v3.0.0
Simple Files Server
An easy to use, static files server made in Node.js
Use case
Its focused on serve static files like front-end files.
How to use
CLI
<command> <source> <options>- command: the command to execute the server, you can use one of those,
simple-files-server,sf-server,sfs. - source:
optionalfile or folder to serve, the server will serve the file or search for theindex.htmlfile if source is a folder.Default: ./ - options:
- port:
optionalthe port to start the server.Default: 3500. - spa:
optionala boolean value, if its is true the server will serve the index.html file if the request path wasn't for a file and no index.html file was found in the path, for example /about.Default: false.
- port:
Programmatically
const filesServer = require('simple-files-server')
const port = process.env.PORT || 3500
const server = filesServer({
//Server Options
})
server.listen(port, /* Custom Log */)Server Options
- source: equal to
sourcecli option. - spa: equal to
spacli option. - mimeTypes:
optionalmime types of files to serve, can be override with anobjector use afunctionthat will receive the default mime types as first parameter and the return of this function will be the new mime types options.
Default MIME types:
{
txt: 'text/plain',
html: 'text/html',
css: 'text/css',
js: 'text/javascript',
xml: 'application/xml',
ts: 'application/typescript',
json: 'application/json',
pdf: 'application/pdf',
jpg: 'image/jpeg',
png: 'image/png',
gif: 'image/gif',
svg: 'image/svg+xml',
ico: 'image/x-icon',
otf: 'font/otf',
ttf: 'font/ttf'
}Custom Log
By default, this function is optional and will show the default logs when start the server. But you can provide a function, which receive the port as first parameter, and write your own logs.
3.0.0
5 years ago
2.2.0
5 years ago
2.1.1
5 years ago
2.0.2
5 years ago
2.0.1
5 years ago
2.0.0
5 years ago
1.2.2
5 years ago
1.2.0
5 years ago
1.2.1
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.1.7
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.0
5 years ago