Giter VIP home page Giter VIP logo

to-dos-api-express's Introduction

Node.js and Express To-Do API Secured with Auth0

To learn how to develop APIs similar to this one, check this article: https://auth0.com/blog/node-js-and-express-tutorial-building-and-securing-restful-apis/

Running

To run this sample, you can either use Docker to decouple the server from the host machine, or you can use Node.js and NPM. Fell free to choose whatever suits you better.

Running with NPM and Node.js

First, you will need to clone this repo in the host machine. After that, on a terminal, run the following commands:

# move into the project root
cd to-do-apis

# install its dependencies
npm install

# run the application
npm start

Running with Docker

There is an image on Docker Hub that you can use. To run it, issue the following command:

docker run -p 3001:3001 -d auth0blog/to-dos-api-express

This will run the project on a Docker container and expose the API on port 3001 on the host. Feel free to adjust these setting to your needs.

Consuming the API

This is a HTTP API (or a RESTful API, if you will). As such, to consume this API you will need to issue HTTP requests from some client. For example, you can use Postman, Insomnia, curl, etc. The following commands show how use the latter:

# request all to-do items
curl localhost:3001

# insert a new to-do
curl -X POST -H 'Content-Type: application/json' -d '{
  "message": "Buy some yummy pizza!"
}' http://localhost:3001/

Updating the Docker Image

# build the image
docker build -t auth0blog/to-dos-api-express .

# push the new version
docker push auth0blog/to-dos-api-express

to-dos-api-express's People

Watchers

 avatar

Forkers

kingidee

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.