[ADD]Node Server Static

This commit is contained in:
Fabien BOURGEOIS 2019-05-04 05:53:23 +02:00
parent 6752558cfe
commit 2513e0d8a6
2 changed files with 26 additions and 6 deletions

View File

@ -1,22 +1,25 @@
{
"name": "odoodockersshcmd",
"name": "odoodockersshadmin",
"version": "0.1.0",
"description": "",
"scripts": {
"dev": "webpack -w",
"prod": "webpack -p"
"prod": "webpack -p",
"serve": "node server"
},
"author": "Fabien BOURGEOIS",
"license": "MPL",
"homepage": "",
"homepage": "https://git.yaltik.net/Yaltik/odsa",
"repository": {
"type": "git",
"url": "https://git.yaltik.net/Yaltik/odoo-docker-ssh-cmd.git"
"url": "https://git.yaltik.net/Yaltik/odsa.git"
},
"private": true,
"dependencies": {
"solid-js": "~0.5.0",
"babel-plugin-jsx-dom-expressions": "~0.7.0"
"babel-plugin-jsx-dom-expressions": "~0.7.0",
"polka": "^0.5.2",
"sirv": "^0.4.0",
"solid-js": "~0.5.0"
},
"devDependencies": {
"@babel/core": "^7.1.0",

17
server.js Normal file
View File

@ -0,0 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
const http = require('http');
const { join } = require('path');
const polka = require('polka');
const sirv = require('sirv');
const { PORT=3000 } = process.env;
const files = sirv('dist');
const server = http.createServer();
polka({ server }).use(files).listen(PORT, err => {
if (err) throw err;
console.log(`> Running on localhost:${PORT}`);
});