This is a basic boilerplate for the MEAN stack (MongoDB, Express, AngularJS and Node.js) on IBM Cloud.
This application uses the IBM Cloud Databases for MongoDB service and Node.js runtime on IBM Cloud.
The code and detailed steps are discussed in the IBM Cloud solution tutorial titled Modern web application using MEAN stack.
npm install
ibmcloud login
ibmcloud target --cf
ibmcloud cf create-service databases-for-mongodb standard mean-starter-mongodb
.env.example
file to .env
and run ibmcloud cf service-key mean-starter-mongodb "Service credentials-1"
for MONGODB_URL and CERTIFICATE_BASE64. Choose your own SESSION_SECRET.node server.js
to start your appNote that the code assumes a secured connection to MongoDB using SSL and a certificate. This way you can run the app locally but connect to IBM Cloud Databases for MongoDB.
An alternative way of running locally is using the provided Dockerfile
.
docker build . -t mean-stack:v1.0.0
docker run -p 6020:6020 -ti mean-stack:v1.0.0
Option 1 (launch this app directly from this repo):
Option 2 (deploy from your local machine):
ibmcloud login
ibmcloud target --cf
ibmcloud cf create-service databases-for-mongodb standard mean-starter-mongodb
ibmcloud cf push
Create a GitHub issue for questions or problems occurs using this demo.
File | Description |
---|---|
manifest.yml | File that defines deployment paramaters. More info here |
.env.example | Set custom environment variables for your application. This is the proper way to store credentials and other sensitive values. |
server.js | Main server file that the Node.js runtime uses. It contains all the server logic. |
/server | Folder for files used by the Node.js server |
/server/models/user.model.js | Model for storing users in MongoDB |
/public | Folder for files delivered to users, such as html and css files |
/public/js/app.js | Angular application for manipulating and rendering data in browser |
There is also generous commenting throughout the application which helps explain critical parts of the application.
Please create a pull request with your desired changes.
The primary source of debugging information for your app is the logs. To see them, run the following Cloud Foundry command using the IBM Cloud CLI:
$ ibmcloud cf logs <application-name> --recent
If you are not sure what your application name is, use this command to print your application name(s):
$ ibmcloud cf apps
For more detailed information on troubleshooting your application, see the Troubleshooting section in the documentation.
See LICENSE.MD for license information.