Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/goyalyatin/mean-website-backend
Backend application written using MEAN stack
https://github.com/goyalyatin/mean-website-backend
expressjs mean-stack mongoose nodejs webservice
Last synced: 6 days ago
JSON representation
Backend application written using MEAN stack
- Host: GitHub
- URL: https://github.com/goyalyatin/mean-website-backend
- Owner: GoyalYatin
- License: mit
- Created: 2019-08-10T12:34:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T05:33:17.000Z (almost 2 years ago)
- Last Synced: 2023-03-07T10:26:29.178Z (over 1 year ago)
- Topics: expressjs, mean-stack, mongoose, nodejs, webservice
- Language: JavaScript
- Homepage:
- Size: 324 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MEAN-Website-Backend
Experimental Backend application written using MEAN stack.Frontend application is written in [MEAN-Website-Frontend](https://github.com/GoyalYatin/MEAN-Website-Frontend) repo.
## Index
- [Todo API](#todo)
- [Architecture](#arch)
- [Setup](#setup)
- [Environment Setup](#env)
- [Database Setup](#db)
- [Project Setup](#project)
- [Testing the API](#test)
- [Insert API](#insert)
- [Get API](#get)
- [Update API](#update)
- [Delete API](#delete)
- [Reference](#ref)
- [License](#license)## Todo Api
A simple todo API made with NodeJS, ExpressJS and MongoDB. Can be used as a back-end for learning front-end technologies without making a standalone API for that purpose.## Architecture
![Highlevel](doc/highlevel.png)Above picture describes how the applications are positioned. This is high level flow.
Testing is done manually using postman for backend application and manually via UI for frontend application. Postman is used to trigger webservice calls. The tests can be automated using Robot framework's requests and ui testing libraries.
![Lowlevel](doc/lowlevel.png)
This picture describes the sequence of the calls, this is low level design for this complete application, this repo only consist of backend side, along with mongoDb setup scipts.
## Setup
#### Environment Setup
- First go here — https://nodejs.org/en/download/ and Install NodeJS.
- Download and Install MongoDB — https://www.mongodb.com/download-center#community
- Download a good Text Editor or IDE. I Personally prefer Visual Studio Code — https://code.visualstudio.com/downloadNow the environment Setup is done. Let’s get into the command line.
First we need to install ExpressJS. The most popular NodeJS Framework.
```
npm install -g express express-generator
```This will install ExpressJS and the ExpressJS Official generator packages. Now let’s generate the Application using the Express Generator.
```
express --view=ejs todoapp
```Now the express App is generated. Go inside the directory.
````
cd todoapp
npm install
````
All the necessary packages will be installed.
At first let’s install all the necessary packages we will be using throughout this app.````
npm install --save bluebird mongoose mongoose-paginate nodemon
````Download and install MogoDB.
Make sure that the database is running at `127.0.0.1:27017`
DB name `todoapp` should be availableNow run `cd todo-api` to go inside the directory
Run `npm install` to install all the dependencies.
Run `npm install -g nodemon` to install Nodemon Globally.
Run `npm start` to run the NodeJS Server.
#### Insert API
This is a POST callURL - `http://localhost:3000/api/todos`
Call Parameters
- title
- description
- statusURL with parameters - `http://localhost:3000/api/todos?title=Test1&description=Testing the insert api&status=pending`
#### Get API
This is a Get callURL - `http://localhost:3000/api/todos`
#### Update API
This is a Put callURL - `http://localhost:3000/api/todos`
URL with parameters - `http://localhost:3000/api/todos?title=Test1&description=Testing the insert api&status=pending&_id=5d5926c8356670fb053ee5ea`
#### Delete API
This is a Delete callURL - `http://localhost:3000/api/todos`
URL with parameters - `http://localhost:3000/api/todos/5d5926c8356670fb053ee5ea`
## Reference
This is learning project inspired from
https://medium.com/netscape/mean-app-tutorial-with-angular-4-part-1-18691663ea96