DEV Community

Cover image for How To Create A Fake REST API For Your Project With JSON Server

How To Create A Fake REST API For Your Project With JSON Server

Tia Eastwood on June 09, 2022

Often you may be building a demo website, or practice project and you need some data for it. As an example, say you're building a demo fashion webs...
Collapse
 
moutafatin1 profile image
moutafatin1 •

There is a way to create a fake JWT to prototype the authentication?

Collapse
 
ecyrbe profile image
ecyrbe •

Yes, it's an express server. You can add custom routes like any express server to generate a valid JWT for the connecting user. And add a JWT validation middleware to protect the other endpoints.

Collapse
 
tiaeastwood profile image
Tia Eastwood •

I'm pretty sure there will be but I haven't done that myself. It's something to investigate for sure!

Collapse
 
sreerajkarippala profile image
sreeraj •

Nice article, #Back project may help you to setup api with JWT. #Back automatically convert app database table to API endpoint, please try at
github.com/WeAreKins/BackNode/rele...

Collapse
 
jarvisscript profile image
Chris Jarvis •

This is very useful. I could use a fake Api and server to a demo.

Collapse
 
vladgen profile image
David •

Hi, nice article. Few weeks ago I discovered DevApiService, it’s a free online tool for mockup APIs or fake APIs. It’s very easy to use and you can mockup API in less than one minute.

Collapse
 
paddyredbeard profile image
Patrick B •

Ah, very useful. I've been using http-server to do something similar, but this is a better fit for my needs. Thanks!

Collapse
 
lambrero profile image
Avin Lambrero •
Collapse
 
andrewbaisden profile image
Andrew Baisden •

Good tutorial! I was using JSON Server a lot until I became confident using NodeJS.

Collapse
 
chismo950 profile image
chismo950 •

Is json server suitable for production environment?

Collapse
 
tiaeastwood profile image
Tia Eastwood •

no, just for practice/demo purposes

Collapse
 
ecyrbe profile image
ecyrbe •

No. It's used to mock APIs. Don't use this on production

Collapse
 
laurenceabas profile image
Laurence Abas •

This is awesome. I'll definitely try this on my upcoming project.

Collapse
 
avelino profile image
Thiago Avelino •

Get to know the moclojer project?
github.com/moclojer/moclojer

Collapse
 
asif530 profile image
asif530 •

Thanks for this short and useful application. I dont get the page localhost:3000/ shows... Did it come with json server?