An easy way to get started with a Express server offering a REST API with Node.js.
- Mongoose
- Express
- REST API
- Windston logger
- Body-parser for Json
install npm package manager
git clone [email protected]:rwieruch/node-express-server-rest-api.git
cd api-server
npm install
start mongodb service (mongod)
npm start
- optional: include .env in your .gitignore
- Create a message with:
curl -X POST -H "Content-Type:application/json" http://localhost:3000/messages -d '{"text":"Hi again, World"}'
- Install Postman to interact with REST API
- Create a message with:
- URL: http://localhost:3000/postMessage
- Method: POST
- Body: raw + JSON (application/json)
- Body Content:
{ "text": "Hi again, World" }