DEV Community

Cover image for 💻 Build a CRUD Express API In ⌚ five minutes!

💻 Build a CRUD Express API In ⌚ five minutes!

Brandon on October 19, 2020

Interested in Express? Unsure how to get started with the MERN (MongoDB, Express.js, React.js, Node.js) ? This tutorial will get you up and running...
Collapse
 
brun0 profile image
bruno-0 • Edited

I know it may sound irrelevant, but what is the benefit of [ -Virtualbox:] and how to apply it ?
Is it like virtual environment (venv) in python ?

Collapse
 
brandonkylebailey profile image
Brandon

Hey Bruno! Thats a great question!

I am running a virtual machine using Oracles VirtualBox. I use this as my sandbox for all of my dev work and sometimes even use virtual environments like venv and docker containers within this virtual machine!

It is somewhat similar to a virtual environment, however it differs because it is designed to function as a full virtualized operating system! You can install different Linux distros and even MacOS and use it as you would a regular computer.

If you want to check out what virtualbox is and how to use it I'll be making a post about it very soon!

Collapse
 
devwhoruns profile image
devwhoruns

With Win10 you can do in WSL2 whatever you are doing in Virtual Box I think

Thread Thread
 
brandonkylebailey profile image
Brandon

I like to keep my environments separated :)

Collapse
 
dcsan profile image
Info Comment hidden by post author - thread only accessible via permalink
dc • Edited

I feel I've written this boilerplate too many times... isn't there a mongoose-restful or some such library? Like postgREST you get an API just from your table migrations...
postgrest.org/en/v7.0.0/

edit - well I guess just using this wouldn't make a very educational article :/
npmjs.com/package/mongoose-rest-api

Collapse
 
harrymckillen profile image
Harry McKillen

Hey Brandon, one small fix
exports.deleteOneRequest is missing the async in the above snippet, so if you run it, you get a syntax error with regards to the await below it.
HTH

Collapse
 
brandonkylebailey profile image
Brandon

Hey Harry! Thanks for commenting. I appreciate the keen eye and I've updated the code snippet ! 😄

Collapse
 
ericchapman profile image
Eric The Coder

Great post. One question: In the updateOneRequest function where the {slug} came from?

Collapse
 
brandonkylebailey profile image
Brandon

Hey Rick, Nice catch! that was an oversite on my part! it should read : {_id:id} not {slug}! my apologies!

Collapse
 
andrewbaisden profile image
Andrew Baisden

Nice post short and concise.

Collapse
 
brandonkylebailey profile image
Brandon

Thanks Andrew!

Collapse
 
filoret265 profile image
Filoret

Hi, I think, some were in
/server/controllers/user.controller.js
is required "usermodel"
?

Collapse
 
brandonkylebailey profile image
Brandon

Hi Filoret, You're totally right, nice catch! I will update that section now ! 😄

Collapse
 
calag4n profile image
calag4n

Very cool post 👍 thanks.

Collapse
 
brandonkylebailey profile image
Brandon • Edited

You're very welcome Calagan! I hope I was able to provide some value for your time! 😄

Collapse
 
brandonkylebailey profile image
Brandon

Thank you Max! I'm hoping to improve with each post 😅

Some comments have been hidden by the post's author - find out more