Giter VIP home page Giter VIP logo

feminist-api's Introduction

Feminist API

The Feminist API is a RESTful API implementation that provides access to randomly generated feminist quotes.

This idea was originally proposed by Patricia Parra. Thanks for the inspiration!

Table of contents

Tech stack

  • ANSI C
  • Docker
  • GNU Make
  • Mongoose web server
  • OpenSSL

How to run

If you want to try out the application you can run the server as a docker container. This step assumes that you have Docker installed.

Method 1 - Use our container build

Simply pull the image from our Docker Hub registry:

# Create a docker container with the application `feminist_api`
docker run -p 8080:8000 -d --name feminist_api vcwild/feminist_api:latest

# Open the application in your browser
xdg-open http://localhost:8080

If you want to know how to use the CLI tool, you can check this topic.

Method 2 - Manual build

If you feel like it, you can build the container yourself:

docker build . -t vcwild/feminist_api:latest

Now you can run the container, as previosly mentioned.

How to develop

Please, follow the instructions below only if you intend to develop for this application.

Requirements

The current instance of the Feminist API project is only supported on Linux distributions.

In order to compile and run the server, it is strongly recommended to get at least a build-essential or equivalent package module, although it might not be required, depending on your system.

DevTools for Debian/Ubuntu

In order to install the build essentials, run the following command:

sudo apt-get install build-essential

DevTools for Fedora/RHEL/CentOS

The Fedora/RHEL/CentOS equivalent to the above is:

sudo yum install make automake gcc gcc-c++ kernel-devel

Other distributions may require different libraries, please check the documentation of your package manager.

Development server

Follow along these steps:

  • Clone this repository

  • Test the server execution with make run.

  • Go to the root of your git clone

  • Run make to build the server

  • IMPORTANT: temporarily update your path to include the current program build.

export PATH=$PATH:$(pwd)
  • Now run the program by executing the feminist_api command.

This command will bind your terminal to the server and wait for requests.

You can also run this as a background process:

feminist_api &

In this case, you can end the process with the following command:

kill $(pgrep feminist_api)

Security (optional step)

This application also supports HTTPS via SSL and TLS.

You will need to install TLS libraries for your distribution:

Security for Debian/Ubuntu

sudo apt-get install libssl-dev libmbedtls-dev

Security for Fedora/RHEL/CentOS

sudo yum install openssl-devel mbedtls-devel

Other distributions may require different libraries, please check the documentation of your package manager.

After the installation, you can compile the dependencies and run the server as previosly mentioned here, but with the caveat that you need to add the TLS libraries to your execution:

make MBEDTLS_DIR=/your/path/to/mbedtls

Using the CLI

The server logs can be accessed via the ada command line interface. This step assumes that the server is already running.

Running the CLI from within a docker container

This step assumes that you already have the server running in a docker container.

Execute ada commands through the docker interface:

docker exec -it feminist_api ada --help

You can also make an alias for that, to make this process easier:

alias ada="docker exec -it feminist_api ada"

Now you can run the CLI as if you were running it from your own terminal:

ada --help

Running the CLI locally

This step assumes that you followed the how to develop guide.

Update your path with the current directory if you don't have it already:

export PATH=$PATH:$(pwd)

Simply execute any CLI interaction by using the ada command.

# e.g. get help from the CLI
ada --help

Install the program

  • It is also possible to install the program with make install. This will add the feminist_api server and the ada CLI to the /usr/local/bin directory permanently.

Contribute

Enjoyed the application? Please, consider contributing to the project.

License

This project is under the GNU General Public License v3.

feminist-api's People

Contributors

github-classroom[bot] avatar vcwild avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

feminist-api'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.