https://github.com/anshul-sonpure/mobilestoreapi
Rest API hosted using render. Crud operation can be performed after authentication on "/products" endpoint.
https://github.com/anshul-sonpure/mobilestoreapi
render rest-api restapi-framework
Last synced: about 1 year ago
JSON representation
Rest API hosted using render. Crud operation can be performed after authentication on "/products" endpoint.
- Host: GitHub
- URL: https://github.com/anshul-sonpure/mobilestoreapi
- Owner: Anshul-Sonpure
- Created: 2023-04-26T07:20:33.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-10T16:34:03.000Z (over 2 years ago)
- Last Synced: 2024-04-14T08:44:45.227Z (about 2 years ago)
- Topics: render, rest-api, restapi-framework
- Language: JavaScript
- Homepage: https://mobilestore-c8yg.onrender.com
- Size: 57.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# _Mobile Store API_
A Fake REST API using json-server with JWT authentication hosted on cloud service render.
Implemented End-points: login,register and products
If you want to clone this repo follow below steps:
## Install
```
$ npm install
$ npm run start-auth
```
Might need to run
```
npm audit fix
```
## How to login/register?
You can login/register by sending a POST request to
```
POST https://mobilestore-c8yg.onrender.com/auth/login
POST https://mobilestore-c8yg.onrender.com/auth/register
OR
POST https://mobilestoreapi.onrender.com/auth/login
POST https://mobilestoreapi.onrender.com/auth/login
```
with the following data or any email, password from users.json
Validation is added for existing email or blank request body in /auth/login or /auth/register endpoints.
```
{
"email": "nilson@email.com",
"password":"nilson"
}
```
You should receive an access token with the following format
```
{
"access_token": ""
}
```
You should send this authorization with any request to the protected endpoints i.e. "/products". You can do all CRUD operation on database.json.
Please note there is no verification / validation on request body send to database.json.
For eg. to access all products you will make a GET call to either of the endpoints("https://mobilestoreapi.onrender.com/products") with Accesstoken.
```
Authorization: Bearer
```
Thank You\
Happy Coding,\
Learn,Code and Earn\
Stay Safe and Stay Positive :)