Giter VIP home page Giter VIP logo

mbti_api's Introduction

MBTI_API

This is a simple API made with the Go programming language. The data is broken down into two fields. One field contains the Meyers-Briggs personality type of the poster, and the other field contains posts authored the user in question seperated by two pipes. There is a script for seeding and creating the SQLite3 database and a second script to start a local server to serve the JSON.

I did not implement any security mechanisms at this time. Do not use this application in a production environment or any other place you will receive unknown input from users. This application is vulnerable to SQL injection due to the method in which the server handles incoming HTTP requests.

Golang gopher running (pixelated

Instructions for setup:

Clone this repository

Download the CSV dataset here and save it in the 'data' directory. Leave the file name as 'mbti_1.csv'

If you want to compile the binaries yourself or run the scripts directly, you will need to install Go. To run the go scripts or to compile the binaries after the language is installed on your computer, use the following instructions:

You can simply run the scripts using the commands below from the root directory of the cloned project.

> go run src/setup_db/populate_database.go
#this step may take a few minutes
> go run src/API/MBTI_API.go
#this will launch your server

if you'd like to compile the binaries and run them, you can do so with the following commands:

> go build src/setup_db/populate_database.go
> ./src/setup_db/populate_database
#this step may take a few minutes
> go build src/API/MBTI_API.go
> ./bin/API/MBTI_API
#this will launch your server

Then you can navigate to localhost:3000/MBTI?type= to see json by MBTI type. This will need to be in all caps with a lowercase type in order to view the proper page.

The API has the following endpoints available:

localhost:3000/MBTI?type=ISTJ
localhost:3000/MBTI?type=ISFJ
localhost:3000/MBTI?type=INFJ
localhost:3000/MBTI?type=INTJ
localhost:3000/MBTI?type=ISTP
localhost:3000/MBTI?type=ISFP
localhost:3000/MBTI?type=INFP
localhost:3000/MBTI?type=INTP
localhost:3000/MBTI?type=ESTP
localhost:3000/MBTI?type=ESFP
localhost:3000/MBTI?type=ENFP
localhost:3000/MBTI?type=ENTP
localhost:3000/MBTI?type=ESTJ
localhost:3000/MBTI?type=ESFJ
localhost:3000/MBTI?type=ENFJ
localhost:3000/MBTI?type=ENTJ

Sample output:

{"MBTI_type":"ENTJ","Posts":"'Post one data||Post two data||Post three data'"}

mbti_api's People

Contributors

boveus avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.