r/node • • Apr 08 '20

I created this RESTful API CRUD Endpoints builder to create Endpoints for MongoDB databases accessed via node apps using Express.js and Mongoose driver.

325 Upvotes

51 comments sorted by

21

u/adityawankhede Apr 08 '20 edited Apr 09 '20

RESTful API CRUD Endpoints

Did not expected that people would be interested in source code. Here it is Source Code on Master Branch

Whenever I created an API I always had to refer to previous projects or online, so I decided to solve this problem once and for all.

RESTful API CRUD Endpoints builder (quite a long name) is what I made while in quarantine. I usually make APIs using ExpressJS and use MongoDB as database, so this is expressjs and mongoose driver specific. Supports basic functionality like:

  • It creates code for Schema and it's Properties.

  • It creates code for CRUD Endpoints.

  • It has the ability to add Sub schemas to a schema.

  • It has proper HTTP Response codes, with message.

  • It has catch block for when promise gets rejected (I was always lazy to add this).

  • It can copy individual as well as all the endpoints at once.

It is not at all responsive.

If this interests you please have a look. Feedback is always welcomed.

18

u/magajohn Apr 08 '20

This is beautiful. I don't use node but what a great and useful tool

10

u/adityawankhede Apr 08 '20

Thanks ๐Ÿ˜Š Happy Cake Day btw ๐ŸŽ‚ ๐ŸŽ‰

6

u/Super_Feeling Apr 08 '20

Happy cake day!

12

u/JottyThePixelPusher Apr 08 '20

Shit bro. That is cool AF. Well done!

8

u/vertigo_101 Apr 08 '20

Looks promising, congratulations

6

u/Sensiduct Apr 08 '20

That's a cool app, but where can I find the source code?

2

u/adityawankhede Apr 09 '20

1

u/Sensiduct Apr 09 '20

Ah yeah, I see.

When I initially saw the source code, I casually viewed gh-pages branch xD
Thanks a lot for the source code release!

-15

u/Sakalalaa Apr 08 '20

Why would you want the source code?

13

u/Sensiduct Apr 08 '20

To explore the code of an interesting project and perhaps customise it for my needs.

What a question, dude? Are you familiar with open-source community?

→ More replies (1)

19

u/Super_Feeling Apr 08 '20

It is supposed to be Date.now not Date.now(), Date.now() will call the function already and the default value set will be the time when your server started.

I've made this mistake before...

7

u/dizzle_izzle Apr 08 '20

Idk why they down voted you im glad you posted this. Working on a project and ABSOLUTELY would've made this error. Just between you and i, I already did!!

Don't tell anyone.

1

u/adityawankhede Apr 09 '20

Oh, sorry my bad! Thanks for the correction ๐Ÿ˜Š๐Ÿ‘

3

u/esreveReverse Apr 09 '20

Call me crazy and I know it's more verbose, but I actually prefer () => Date.now(). It's more clear about intent.

4

u/msichy Apr 08 '20

This is pretty cool. Are you making the source code available?

3

u/adityawankhede Apr 09 '20

2

u/msichy Apr 09 '20

Thank you! I really appreciate it, nice workยจฬฎ

7

u/graham_taylor Apr 08 '20

Looks awesome!

Learning both Express and Mongoose, can you or someone tell me what "Select" is for in the Schema?

I've tried searching the Mongoose and Mongo docs, couldn't find why it's used in the Schema.

6

u/BrewingSense Apr 08 '20 edited Apr 09 '20

It's used to select/deselect fields from db responses to the client.

mongoose-mongodb-exclude-select-fields

3

u/graham_taylor Apr 08 '20

Wow, ok thank you, didn't even know that. Learned so far the 'required' and the 'type'.

Thanks again!

1

u/tbistONE Apr 08 '20

Amazing. Nice job!

1

u/adityawankhede Apr 09 '20

Thank you ๐Ÿ˜Š

1

u/m0dernj3j3 Apr 08 '20

Awesome dude! This is very helpful!

1

u/adityawankhede Apr 09 '20

Thanks, glad you find it useful

1

u/barrard123 Apr 09 '20

This is really awesome!

1

u/leejh3224 Apr 09 '20

Looks neat and clean. It would have been better if the code was highlighted as well.

1

u/adityawankhede Apr 09 '20

Thank you. At first I had the same idea in mind to highlight the code. But the <textarea> tag does not support highlighting and I didn't knew any better way to implement copy functionality without having to use textarea. So I kinda had to adjust with no highlighting.

1

u/[deleted] Apr 09 '20

Love it. This fits my workflow so perfectly. Thank you

2

u/adityawankhede Apr 09 '20

Thanks, glad you find it useful. Let me know if you ever encounter an error because of the generated endpoints or schemas.

1

u/vipulw20 Apr 09 '20

@adityawankhede This is really awesome bro. ๐Ÿ™Œ

1

u/taitai3 Apr 09 '20

Awesome work

1

u/wlkngmachine Apr 09 '20

Very cool! Is this essentially the same idea as how u would build a CMS?

1

u/pratiks3 May 05 '20

Great to see this coming along ! I remember looking at the Trello board about a year ago and thought this is going to be very exciting. Congrats.

0

u/[deleted] Apr 08 '20

[deleted]

3

u/[deleted] Apr 08 '20

Fork it buddy

0

u/[deleted] Apr 08 '20

[deleted]

1

u/awesomeevan Apr 08 '20

As someone who loves TS, thank you haha!