๐บ Beer app ๐บ
I really want to learn MEAN Stack. But I want to do this step by step. So I've decided to proceed in 3 steps:
- AngularJS with a json file
- AngularJs + Web API (by using APISpark)
- MEAN Stack (Mongodb, Express, AngularJs & Node.js)
I also decide do work with beer, because it's funniest than contact, products, todo-task, ... Thanks to @lostinbrittany for his json file and images.
I also use twitter Bootstrap because I won't spend time to code css.
If you found a typo or a mistake somewhere, please fork and edit this post. Thank you :)
Installation
- Download the code
- Install the npm modules:
npm install
Use the--no-bin-links
argument if it fails.
Step 1: AngularJs - json file
Here, you can manage your beers with CRUD operations.
Note that all fields are mandatory (except description).
Step 2: AngularJs + Web API (APISpark)
In a nutshell, APISpark is a Platform-as-a-Service dedicated to web API. You can manage, host, consume API for free (if you use less than "10 Concurrent Clients").
Here, my Web API is public. So you can access to my dashboard.
If data are empty, or if you find errors, please reinitialize the database (Reinitialize button).
Note: Further reading about JS Promise (because it's a so powerful feature ;-))
Step 3: MEAN Stack (Mongodb, Express, AngularJs & Node.js)
- Initialize database (2 ways):
- Import data with json file:
mongoimport --db beers --collection beers --jsonArray step1/beer-list.json
- Or : Use the reinitialize button
- In the server/server.js file, change the endpoint according to your configuration (replace scotch.local:3000 to something like localhost:3000).
- Start the server:
npm start
.
You will need nodemon :npm install -g nodemon
- Visit the application in your browser at http://localhost:3000/ (you will see "Hello beer!")
- Enjoy beer ๐บ
Tests:
- Install mocha:
npm install -g mocha
- Run tests: npm test