static_server_express

1.0.0 • Public • Published

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()

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i static_server_express

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

5.7 kB

Total Files

8

Last publish

Collaborators

  • crodriguez_inforser