static_server_express
v1.0.0
Published
With this package you can create a static server with express module and static files, for compiled and builded projects who need a server to host the files, with frameworks like react.
Downloads
2
Readme
STATIC SERVER WITH EXPRESS
With this package you can create a static server with express module and static files, for compiled and builded projects who need a server to host the files, with frameworks like react.
Installation
Use the package manager yarn or npm to install the module.
Yarn
yarn add -s static_server_express
npm
npm i -s static_server_express
Usage
ES6
import { createServer } from 'static_server_express'
import { join } from 'path'
// Intance server with absolute path
const server = createServer(join(__dirname, '/public'))
// Listen server, accept callbacks in second argument
server.listen(3000, () => console.log("server is ready") )
// Export module of server
module.exports = server.getServer()
ES2015
const { createServer } = require('static_server_express')
const { join } = require('path')
// Intance server with absolute path
const server = createServer(join(__dirname, '/public'))
// Listen server, accept callbacks in second argument
server.listen(3000, function() { console.log("server is ready") } )
// Export module of server
module.exports = server.getServer()