accelerator-testing v0.0.9
Accelerator using MEAN stack
This repository contains reusable components such as authentication, dashboard,etc. developed using MEAN stack (MongoDB, Express, AngularJS and Node.js).
Pre-requisites
git - Installation guide https://www.linode.com/docs/guides/how-to-install-git-on-linux-mac-and-windows/ . node.js - Download page https://nodejs.org/en/download/. npm - comes with node or download yarn - Download page https://classic.yarnpkg.com/en/docs/install#windows-stable. mongodb - Download page https://www.mongodb.com/try/download/community2.
Features
- Reusable components
- MVC project structure
- Create, edit and delete user accounts
- Authentication with username/password
- Protected routes that can only be accessed by authenticated users
- Bootstrap SCSS framework
- HTTPS built-in
- Mongoose for MongoDB interactions.
- JWT for authentication, with over 300 authentication strategies to pick from.
Installation
git clone https://gitlab.com/credex-technology-team/accelerator-mean cd accelerator-mean npm install --save ng serve for running the frontend development npm run server for running the backend development
Files & Folders
File | Description |
---|---|
.env.example | Set custom environment variables for your application. This is the proper way to store credentials and other sensitive values. |
app.js | Main server file that the Node.js runtime uses. It contains all the server logic. |
/backend** | Folder for files used by the Node.js server |
/backend/models/user.model.js | Model for storing users in MongoDB |
/src/app** | Folder for files delivered to users, such as html and css files |
/src/app/** | Angular application for manipulating and rendering data in browser |
Application
- MongoDB stores user account information and persists sessions (so that a server crash does not log out all users.)
- Express functions Node.js middleware to handle all HTTP requests and routing.
- Angular handles HTML templating and data manipulation.
- Node.js is the runtime for the application.
There is also generous commenting throughout the application which helps explain critical parts of the application.
Running locally
- Clone or download this repo onto your machine.
- Install application requirements(## Pre-requisites) if not done so already.
- Open application directory in your terminal and run
npm install
- Create the instance of Databases for MongoDB on Cloud
- Copy
.env.example
file to.env
. Edit.env
to fill it the required values. You can runcreate mean-starter-mongodb-key --instance-name mean-starter-mongodb
to obtain the MONGODB_URL and CERTIFICATE_BASE64. Choose your own SESSION_SECRET. - Run
node app.js
to start your backend app - Run
ng serve
to start your frontend app - Open a browser to the link provided in the terminal prompt to view your app
Note 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 Cloud Databases for MongoDB.
Development server
Run ng serve
for a dev server. The application will automatically reload if you change any of the source files.
(Default browser is http://localhost:4200/)
Further help
To get more help on the MEAN stack Reference(https://www.mongodb.com) Express Angular Nodejs