Skip to content

BobbyMcWho/list-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

list-api

This is a basic REST API made using Node.JS, Express, and MongoDB.

How to use this?

Clone the repository. Install mongodb on your machine, using the instructions found here. (If you are on Windows you may need to edit your path variables to allow mongo/mongod to be run from the command line.)

run $ npm install in the root of the repository.

Create a directory named 'data' within the root of the repository, then a subdirectory called 'db'.

Open a command prompt at the root of your directory, and type the following command: $ mongod --dbpath .\data\db If you installed mongodb correctly, you will receive a lot of logs to the console, the process will stay running.

Open a new command prompt (leave the old running) in the new one, start your server using: $ node server.js

You should get a response "We are live on 8000." This is the port set in your server.js file.

#REST You can make HTTP requests to localhost:8000/notes.

GET: http://localhost:8000/notes will return all notes in the notes list.
POST: http://localhost:8000/notes your content type should be application/json and your body should include an object with {"text":[your text],"title":[your title]}.
GET: http://localhost:8000/notes/[noteid] will return the note with the given id.
PUT: http://localhost:8000/notes/[noteid] same as post, but your body may include text and/or title key value pairs.
DELETE: http://localhost:8000/notes/[noteid] will delete the note with the id specified.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published