GithubHelp home page GithubHelp logo

crud-nodejs-mongodb's Introduction

Nodejs and MongoDB CRUD Template

To run this template out of the box on Brev click here:

Much of the code in this was borrowed from Tien Nguyen. Please check him out!

This repo runs a CRUD app which allows you to add and delete tutorials. A tutorial has the shape:

{
  "title": "Learning to code",
  "description": "How to learn the best skill in the world",
  "published": true
}

Running everything in docker-compose:

There are two services in this repo: the backend node api and the database. Running:

docker-compose up

will spin them both up.

Running the backend outside of Docker Compose:

You can then pull the backend node service out of docker compose and run it locally:

  1. Comment out lines 15 to 30 of docker-compose.yml
  2. Run:
docker-compose up
  1. Then cd into backend and run it via npm:
cd backend
npm i
npm start

Making calls to your server:

To view all tutorial entries:

curl http://localhost:8080/api/tutorials

To add a new tutorial:

curl --request POST \
  --url http://localhost:8080/api/tutorials \
  --header 'Content-Type: application/json' \
  --data '{
	"title": "Learning to code",
	"description": "How to learn the best skill in the world",
	"published": true
}'

Forwarding ports:

To forward a port to your local machine (if you're using Brev), in VScode you should see a ports section next to terminal. Enter port 8080 to forward.

crud-nodejs-mongodb's People

Contributors

samlhuillier avatar tienbku avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.