Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/osandadeshan/maxsoft-mock-server-demo
This is a demo project for Mock server development and deployment using Express and Firebase.
https://github.com/osandadeshan/maxsoft-mock-server-demo
deployment develpment express firebase mock mock-server
Last synced: about 19 hours ago
JSON representation
This is a demo project for Mock server development and deployment using Express and Firebase.
- Host: GitHub
- URL: https://github.com/osandadeshan/maxsoft-mock-server-demo
- Owner: osandadeshan
- Created: 2020-04-27T03:27:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-09T12:22:30.000Z (almost 2 years ago)
- Last Synced: 2023-02-27T12:16:59.789Z (over 1 year ago)
- Topics: deployment, develpment, express, firebase, mock, mock-server
- Language: JavaScript
- Homepage:
- Size: 694 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MaxSoft Mock Server Demo
A simple mock API server using [Express.js](https://expressjs.com/) that is hosted on [Firebase](https://firebase.google.com/).![](https://miro.medium.com/max/1890/1*gfp_i-c0GPznwnwEx8Nhgg.png)
## Why custom mock server
You have full control of what API to define and what data to respond with with minimal coding.## How it works
The APIs are defined via Express.js framework and served though Firebase cloud functions. All the defined API can be found at [functions/index.js](https://github.com/osandadeshan/maxsoft-mock-server-demo/blob/master/functions/index.js) and pre-loaded mock responses example can be found at [mock-responses](https://github.com/osandadeshan/maxsoft-mock-server-demo/tree/master/functions/mock-responses).* References: https://expressjs.com/en/guide/routing.html
#### GET Routes
1. Hello! \
https://maxsoft-mock-server-demo.web.app/say/hello?name=Osanda2. Get User Details \
https://maxsoft-mock-server-demo.web.app/users/13. Get large list of photos response from mocked JSON file \
https://maxsoft-mock-server-demo.web.app/photos4. Get a single photo item from mocked JSON file \
https://maxsoft-mock-server-demo.web.app/photos/29647#### POST Route
1. Register a new user**Success**
```
curl -X POST \
https://maxsoft-mock-server-demo.web.app/register \
-H 'Content-Type: application/json' \
-d '{"userId": "myusername", "email":"[email protected]", "name": "New User"}'
```**Fail**
```
curl -X POST \
https://maxsoft-mock-server-demo.web.app/register \
-H 'Content-Type: application/json' \
-d '{"userId": "existingId", "email":"[email protected]", "name": "Existing User"}'
```> NOTE: You will have to use terminal to execute these curl commands or you can import [postman collection](https://www.getpostman.com/collections/4414bc745e79aedb2173)