plhosk / ratchet-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo App - Node.js/Koa API server

MongoDB Server

  • If you have a local MongoDB server running, you may edit the file .env to point to the correct URI (default mongodb://localhost:27017/ratchet-api)
  • If you do not have MongoDB running but you have it installed and mongod is in the path, run ./mongo-start.sh to start a MongoDB server in the terminal. The data directory will be set as ./mongodb/data
  • Alternatively ./mongo-background.sh will start a server in the background
  • If you do not have a MongoDB server you can download it here

How To Start Demo App API Server

  1. This app is tested on Node.js 10.7.0
  2. npm install to install npm packages
  3. npm start to run server (the equivalent command is node ./server/index.js)
  4. Default port is 3000
  5. Use the Demo App front-end to interface with this API

Endpoints

  • GET /items
  • POST /items with body { title: String, column: Number }
  • DELETE /items/:id
  • GET /log

Testing

  • npm test to test the API endpoints

About


Languages

Language:JavaScript 98.8%Language:Shell 1.2%