This is not Tutorial of any kind for MEAN, If you are MEAN newbie or familiar with advanced Javascript has already started to learn MEAN stack, you can you use following article and its code helpful to kick start your MEAN project or you never know might end up learning somethingĀ š
Following are some steps by steps instructions regarding how I created this MEAN starter code with CRUD as usual.
Download Nodejs
node -v (to check version)
Download MongoDb
Create Db and at least one standard Collection to start with
Run following commands (to initialize nodejs project)
npm init (follow instructions on VS Code terminal)
npm i express mongoose body-parser (to download to install express fx, mongoose package to access mongodb and easily parse through body-parser)
Create db.js in root like below to create connection between mongodb and your application
Create index.js (to setup external packages and open port and setup controllers)
Create your collection model in code, I created Crypto Coin model (its trendy, isnāt it)
Create Controller.js class for your CRUD operations
- Import Express, Mongoose, and Coin model
- Create router for Get/Update/Add/Delete
- Create Angular project using following command
- npm install -g @angular/cli
- App Module is place where you can add angular packages modules, components
- In this app, i added Forms module, HttpClient, CoinComponent
- Angular App consists on Components, Services, Model, Forms
- Coin Service will be responsible to access your API (REST) methods
- Angular app is consist on Components, i created Coin Component which is going to be middleware between component HTML and Service.
Application code flow would be like below
HTML ā Component.ts ā Service.ts ā Controller.js ā Model.js ā Mongoose ā MongoDb
Code on GithubĀ https://github.com/adnanaman/MEAN-StarterCodeĀ