Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rwieruch committed Jan 4, 2019
0 parents commit f18793f
Show file tree
Hide file tree
Showing 9 changed files with 4,277 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .babelrc
@@ -0,0 +1,5 @@
{
"presets": [
"@babel/preset-env"
]
}
1 change: 1 addition & 0 deletions .env
@@ -0,0 +1 @@
PORT=3000
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
logfile

node_modules/
6 changes: 6 additions & 0 deletions .prettierrc
@@ -0,0 +1,6 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 70,
}
10 changes: 10 additions & 0 deletions .travis.yml
@@ -0,0 +1,10 @@
language: node_js

node_js:
- stable

install:
- npm install

script:
- npm test
54 changes: 54 additions & 0 deletions README.md
@@ -0,0 +1,54 @@
# Simple Node with Express + MongoDB Server

[![Build Status](https://travis-ci.org/rwieruch/node-express-mongodb-server.svg?branch=master)](https://travis-ci.org/rwieruch/node-express-mongodb-server) [![Slack](https://slack-the-road-to-learn-react.wieruch.com/badge.svg)](https://slack-the-road-to-learn-react.wieruch.com/) [![Greenkeeper badge](https://badges.greenkeeper.io/rwieruch/node-express-mongodb-server.svg)](https://greenkeeper.io/)

An easy way to get started with a Express server with MongoDB with Node.js.

## Features

* Babel 7
* Environment Variables
* Express
* MongoDB

## Requirements

* [node & npm](https://nodejs.org/en/)
* [git](https://www.robinwieruch.de/git-essential-commands/)

## Installation

* `git clone git@github.com:rwieruch/node-express-mongodb-server.git`
* `cd node-express-mongodb-server`
* `npm install`
* [start MongoDB](https://www.robinwieruch.de/mongodb-express-setup-tutorial/)
* `npm start`

### GET Routes

* visit http://localhost:3000
* /messages
* /messages/1
* /users
* /users/1

### Beyond GET Routes

#### CURL

* Create a message with:
* `curl -i -X POST -H "Content-Type:application/json" http://localhost:3000/messages -d '{"text":"Hi again, World"}'`
* Delete a message with:
* `curl -i -X DELETE -H "Content-Type:application/json" http://localhost:3000/messages/1`

#### Postman

* Install [Postman](https://www.getpostman.com/apps) to interact with REST API
* Create a message with:
* URL: http://localhost:3000/messages
* Method: POST
* Body: raw + JSON (application/json)
* Body Content: `{ "text": "Hi again, World" }`
* Delete a message with:
* URL: http://localhost:3000/messages/1
* Method: DELETE

0 comments on commit f18793f

Please sign in to comment.