Giter Site home page Giter Site logo

spearserver's Introduction

API

all of these are prepended by blog
posts.GET("/post/:id", getPost) // this gets the post by the actual ID
posts.GET("/search/tag/:id", getByTag)
posts.GET("/search/string/:id", getByString)
posts.GET("/posts", getPosts) // this supports the query string offset, and number
//     offset: specifies the number of recent blog posts to skip. Default 0
//     number: upper limit on the number of blog posts to return. Default 5
// Eg) to get the most recent 5 posts
// GET http://this-blog-server.com:8049/blog/posts
// to get the next 10 most recent posts
// GET http://this-blog-server.com:8049/blog/posts?offset=5&number=10

posts.GET("/number, getPostCount) // number of posts


posts.PUT("/", putPost)
posts.DELETE("/:id", deletePost)

A post is a json object with the following structure

type Post struct {
    ID        int      `json:"id"`
    Title     string   `json:"title"`
    Author    string   `json:"author"`
    Post      string   `json:"post"`
    Timestamp uint64   `json:"timestamp"`
    Tags      []string `json:"tags"`
}

Setup

  1. Install go
  2. Get files with go get github.com/jacobrec/spearserver
  3. Install mysql server
  4. In mysql create a database and a user and grant that user all privaliges on that database
  5. Place .passwords file in the src/github.com/jacobrec/spearserver directory
  6. From the src/github.com/jacobrec/spearserver directory build the project with go build
  7. run with -setup from the src/github.com/jacobrec/spearserver directory
  8. run normally from the src/github.com/jacobrec/spearserver directory to start webserver

Passwords file

should have the name .passwords file should be 3 lines and read like this. the username, password, and database refer to the sql database and user you just created

username
password
database

This file needs to be placed in the directory of which you run the program from

spearserver's People

Contributors

jacobrec avatar kylehennig avatar

Stargazers

Navras Kamal avatar

Watchers

 avatar  avatar

spearserver's Issues

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.