Skip to content
A simple mock API server using expressjs that is hosted on firebase.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
functions
public
.firebaserc
.gitignore
LICENSE
README.md
firebase.json

README.md

firebase-mock-api-server

A simple mock API server using Express.js that is hosted on Firebase.

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

See medium article https://link.medium.com/OAjz9kkV0U on how to setup firebase project and setup mock server.

Show me examples

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 👈 and pre-loaded mock responses example can be found at mock-responses

Simple GET

https://mock-apis-server.firebaseapp.com/say/hello

https://mock-apis-server.firebaseapp.com/say/hello?name=Ryan

Capture data from URL

https://mock-apis-server.firebaseapp.com/users/myid

POST data to register new account

Success

curl -X POST \
  https://mock-apis-server.firebaseapp.com/register \
  -H 'Content-Type: application/json' \
  -d '{"userId": "myusername", "email":"my@email.com", "name": "New User"}'

Fail

curl -X POST \
  https://mock-apis-server.firebaseapp.com/register \
  -H 'Content-Type: application/json' \
  -d '{"userId": "taken", "email":"existing@email.com", "name": "Existing User"}'

NOTE: You will have to use terminal to execute these curl commands.

Large list of photos response from mocked JSON file

https://mock-apis-server.firebaseapp.com/photos

Single photo item from mocked JSON file

https://mock-apis-server.firebaseapp.com/photos/29647

Use 🔥 Firebase Firestore database

Using firebase console you can easily update the database values to reflect new values in realtime without needing to touch JSON source files.

You can’t perform that action at this time.