8. @aroach@CiscoDevNetdeveloper.cisco.com
How we ran it
• Three challenges per day (Jive site)
• Answers were provided at the beginning of the next day
• Support via a Cisco Spark room
• Submissions were analyzed after the event
• Small monetary rewards to top 3 finishers
14. @aroach@CiscoDevNetdeveloper.cisco.com
Technologies involved and evaluated
• I know MEAN stack (Mongo, Express, Angular, Node)
• I wanted to try out building using a REST modeling tool
• Swagger-node
• Osprey (RAML-based): seemed less feature rich
• Containerized to be deployed on ciscoshipped.io
• GitHub
• Postman
• MongoHub (Mongo client)
• mLab (Hosted mongo)
15. @aroach@CiscoDevNetdeveloper.cisco.com
OpenAPI Spec (fka Swagger)
• Open specification for describing REST APIs
• A top-down approach where you would use
the Swagger Editor to create your Swagger definition
and then use the integrated Swagger Codegen tools to
generate server implementation.
• A bottom-up approach where you have an existing
REST API for which you want to create a Swagger
definition.
16. @aroach@CiscoDevNetdeveloper.cisco.com
Dockerfile
FROM node:5.11.1
# Create app directory
RUN mkdir -p /usr/src/app
# Establish where your CMD will execute
WORKDIR /usr/src/app
# Bundle app source into the container
COPY ./node_modules /usr/src/app/node_modules
COPY ./api /usr/src/app/api
COPY ./config /usr/src/app/config
COPY ./app.js /usr/src/app/
# Expose the port for the app
EXPOSE 10010
# Execute "node app.js"
CMD ["node", "app.js"]
17. @aroach@CiscoDevNetdeveloper.cisco.com
Docker run --link
• Legacy container links within the Docker default bridge.
• This is a bridge network named bridge created
automatically when you install Docker.
• Superceeded by Docker Networks feature
18. @aroach@CiscoDevNetdeveloper.cisco.com
Makefile
run:
docker run --rm --name $(NAME)-$(INSTANCE) $(LINK)
$(PORTS) $(VOLUMES) $(ENV) $(NS)/$(REPO):$(VERSION)
$ make run
$ docker run --rm --name devnet-challenge-api-default
--link mymongo:mongo -p 8080:10010 --env-file=.env
ciscodevnet/devnet-challenge-api:v1
19. @aroach@CiscoDevNetdeveloper.cisco.com
Node Libraries Used
• Swagger-node
• Express: Node HTTP server
• Bcrypt: Password hashing in DB
• Mongoose: Node mongo library
• Jsonwebtoken: JWT library
• Password-generator: generate random passwords
• Marked: Convert Markdown to HTML for docs