r/node • u/adityawankhede • 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.
18
12
8
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?
→ More replies (1)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?
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
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
Thanks, Yes the source code is available at https://github.com/adityawankhede5/restful-api-crud-endpoints/tree/master
2
2
u/rw3iss Apr 09 '20
Nice - gonna open source it so we can hack it for mysql etc? :-)
2
u/adityawankhede Apr 09 '20
Yes, would love to see it grow! https://github.com/adityawankhede5/restful-api-crud-endpoints/tree/master
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.
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
1
1
1
1
1
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
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
1
1
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
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.