No description
Find a file
2026-02-20 19:27:58 +08:00
api_v1 Aggiorna api_v1/server.js 2026-02-20 19:27:58 +08:00
node_modules first commit 2024-11-01 08:00:42 +00:00
public Aggiorna public/index.html 2026-02-20 18:59:55 +08:00
.env Aggiorna .env 2026-02-20 19:00:53 +08:00
db.json first commit 2024-11-01 08:00:42 +00:00
index.html Upload files to "/" 2024-11-01 08:11:44 +00:00
license.md first commit 2024-11-01 08:00:42 +00:00
package-lock.json first commit 2024-11-01 08:00:42 +00:00
package.json Aggiorna package.json 2026-02-20 19:04:07 +08:00
readme.md Aggiorna readme.md 2025-07-17 23:16:16 +08:00

Protected REST API with json-server and JWT

This project allows us to use an API Rest to develop in the frontend with mock datas before the backend is finished.

Install

Clone this repo on your machine and before run npm i to install all dependences.

Start/Stop servers

Description Script
Start server without auth npm start
Start server with auth npm run start-auth

Tools

Description Script
Generate user hashed passwords npm run hash

Endpoints for auth server

Endpoint Description
localhost:4000/auth/login Login user
localhost:4000/photos Products list (token needed)

Change port

in package.json mod -p 4000

json-server api reference

How use

  • npm run start-auth
  • utilizzare index.html per leggere le foto

without auth

  • npm start

Inspired in this post by Techiediaries