production

说说对npm的开发模式和生产模式的理解

江枫思渺然 提交于 2020-03-02 04:54:15
nodejs这些年的发展非常快,相信没有哪个前端不知道的了,npm也成为了前端开发中经常用到了的一个命令。那么npm不是只用一个 "npm install xxx"命令就够了吗?实际上并不是这样,发现有些团队在使用npm的时候没有认真去搞懂npm在团队里面或者说是在项目里面的一些用法。 1.从认识package.json开始   在团队里面开发,一般会分为开发模式和生产模式(可能会有不同的叫法),有时候还有测试模式,那么这些模式其实跟npm有很大的联系的。首先看一个简单的例子,先从npm依赖的package.json文件开始。 { "name": "test", "version": "1.0.0", "description": "test", "main": "app.js", "scripts": { "dev": "gulp dev && node app", "pro": "node app" }, "keywords": [ "test" ], "dependencies": { "koa": "^1.2.0" }, "devDependencies": { "gulp": "^3.9.1", "koa": "^1.2.0" }, "author": "test", "license": "MIT" }   这个很简单的package.json写法的例子

nodejs express app deploying to production

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-21 12:07:37
问题 Sorry if this is a basic question, I am still wrapping my head around nodejs deployments. I have an app written on nodejs which I want to deploy to production. So far for testing purposes I have used Express. However from what I know Express is a dev server and not a production server. How do I deploy the nodejs app to production and what is the server I should use. Plus I have a lot of code written for express like routes and middleware, how does this work when I deploy to another server?

How to get Mern Stack to work on Heroku

喜夏-厌秋 提交于 2020-01-14 06:05:07
问题 I'm testing out the Mern Stack (Mongo Express React/Redux Node) and set it up with development with no issue. Now I'm trying to deploy to Heroku. I did a git push heroku master just like normal, but when I check out the website I see Heroku's Application Error. I added a MongoDB through Heroku, and changed my heroku config variables, so it uses that db (I think I did this correctly). So I check into logs: npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn

Set Environment variables on Engine Yard

橙三吉。 提交于 2020-01-12 05:50:52
问题 My app is on Engine Yard services and I need to set the environment variables to work with my secret id and password. Somebody know how I can set each variables? What is the best way to do this? 回答1: I've just managed to set environment variables for my application running on Unicorn. Open /data/{app_name}/shared/config/env.custom and edit it to look like this: export SECRET_ID=yourid export SECRET_PASSWORD=yourpass Restart unicorn /engineyard/bin/app_{app_name} reload If you are using

Django database settings for production server

做~自己de王妃 提交于 2020-01-07 04:19:09
问题 I have a problem with Django database configuration with 'postgresql_psycopg2' If I give any arbitrary name to my database like below, DATABASES = { 'default': { 'ENGINE': 'postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'xyz', # Or path to database file if using sqlite3. 'USER': 'postgres', # Not used with sqlite3. 'PASSWORD': '${my_password}', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with

Refreshing React with Express server

≯℡__Kan透↙ 提交于 2020-01-06 08:10:13
问题 I have looked through the questions and can't seem to find the answer. There are similar ones but none that have helped. Here is the deal. I am trying to refresh my React page on any page but home i.e. https://amazingdomain/nextpage I know, if I am on this page and I refresh I will get the Express 404 because it doesn't know what to send. My Server is hosted on AWS as an EC2 instance and my Frontend is hosted on a popular hosting site. Everything works fine until I try to refresh on a page

Docker Container management in production environment

限于喜欢 提交于 2020-01-06 02:11:28
问题 Maybe I missed something in the Docker documentation, but I'm curious and can't find an answer: What mechanism is used to restart docker containers if they should error/close/etc? Also, if many functions have to be done via a docker run command, say for instance volume mounting or linking, how does one bring up an entire hive of containers which complete an application without using docker compose? (as they say it is not production ready) 回答1: What mechanism is used to restart docker

Webpack production build does not load anything

微笑、不失礼 提交于 2020-01-04 05:45:15
问题 I've been working on an app using React and Webpack for a little while. My development environment works fine, and everything loads properly using webpack-dev-server. I decided to run a production build of the application to see what the end-product might look like size-wise and observe the general output of the webpack product build. It turns out that running webpack -p , while it does produce output (more on that in a minute), does not load anything at all when I hit the site in a browser..

CSV not working for Rails 3 in Production using passenger

一世执手 提交于 2020-01-04 01:58:08
问题 I currently have a problem where i am exporting some data and generating a CSV in rails3. In my controller i add the following at the top. require 'CSV' I then have my method that generates the CSV file. In development i am able to generate and download the csv file just fine but in production mode, passenger returns me the following error. No such file to load -- CSV wondering if anyone has had this issue because i thought the CSV library included in ruby 1.9.2, i am not using any gems for

node.js config npm - NODE_CONFIG_ENV

删除回忆录丶 提交于 2020-01-04 01:36:51
问题 I am trying to use the config package (npm install config) to be able to use different configurations for different enviromenets. I am running it on windows 10. I got 4 files under the config folder : default.json, development.json, production.json and qa.json. when i am running SET NODE_ENV=production for example it applys to it but config still aint taking the info from the right file. var config = require('config'); var port = config.get('appPort'); I done some reading and i found out