Giter Club home page Giter Club logo

guestbook's Introduction

Guestbook

An automation targeted simple guestbook web app implemented with Go, MongoDB and Bootstrap, inspired by mthaler/guestbook

Design Goals

The focus of this project is to demonstrate how to implement a simple web app using Go, MongoDB and Bootstrap. Security is not a concern, thus it should not be used on production systems.

Requirements

Installing MongoDB

To build and run the guestbook web app, MongoDB needs to be installed, see https://docs.mongodb.com/manual/installation/

Note: MongoDB is not included in recent versions of Debian, follow the installation instructions above.

Make sure that mongod is started before running the guestbook web app.

Installing MongoDB Go Driver

The driver can easily be installed with go get:

$ go get go.mongodb.org/mongo-driver

go get will print a warning that there are no go files. This can be ignored.

Usage

Use the following command to run the guestbook web app from the guestbook directory:

$ go run main.go

If the guestbook application can connect to the MongoDB database, it will print a message, otherwise it will print an error message.

Open a browser with the following URL:

http://localhost/guestbook

An empty guestbook should now be shown. New comments can be added by clicking on add comment.

Manipulating the Database

MongoDB includes a shell that can be used to manipulate the database. See the MongoDB documentation for details.

To delete all comments, stop the guestbook web app and do the following

$ mongo
> use guestbook
switched to db guestbook
> db.comments.drop()
true

After starting the guestbook again, an empty guestbook is shown.

Credits

The code is based on the guestbook example from the Head First Go book.

License

BSD 3-Clause License

guestbook's People

Contributors

mthaler avatar ydp avatar

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.