Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Load express from external module
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Aug 18, 2017
1 parent 61c4419 commit 4b9a55f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[![NPM Status](https://img.shields.io/npm/dm/srv.svg?style=flat-square)](https://www.npmjs.org/package/srv)
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square)](https://paypal.me/Kikobeats)

> Express with development experience features
> HTTP server with Hot Module Replace (HMR) capabilities for development.
## Install

Expand Down
6 changes: 4 additions & 2 deletions bin/serve/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const express = require('express')
const importCwd = require('import-cwd')
const path = require('path')

const listenMessage = require('./listen-message')
Expand All @@ -9,10 +9,12 @@ const getPort = require('./get-port')
module.exports = async ({ filename, filepkg, cli, restarting }) => {
const { userPort, port, inUse } = await getPort(cli)

const app = express()
const filepath = path.resolve(process.cwd(), filename)
const module = require(filepath)

const express = importCwd('express')
const app = express()

module(app, express)

const server = app.listen(port, () => {
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "srv",
"description": "Running HTTP server with development experience",
"description": "HTTP server with Hot Module Replace (HMR) capabilities for development",
"homepage": "https://documentup.com/Kikobeats/srv",
"version": "0.0.0",
"bin": {
Expand All @@ -21,6 +21,12 @@
"url": "https://github.com/Kikobeats/srv/issues"
},
"keywords": [
"refresh",
"hrm",
"hot",
"module",
"replacement",
"reload",
"express",
"micro",
"http",
Expand All @@ -38,10 +44,10 @@
"chalk": "~2.1.0",
"chokidar": "~1.7.0",
"clear-module": "~2.1.0",
"express": "~4.15.4",
"get-port": "~3.1.0",
"ignore-by-default": "~1.0.1",
"ignored": "~2.0.4",
"import-cwd": "~2.1.0",
"ip": "~1.1.5",
"json-future": "~2.1.2",
"log-symbols": "~2.0.0",
Expand Down

0 comments on commit 4b9a55f

Please sign in to comment.