- WeKnow is a social education platform where people can share resources and interact to learn
-
The platform has the following main features
- Users can share textual, audio and video resources
- Users can follow one other to get feed on shared content
- Users can recommend and comment on a shared resource
- Users can create a collection of shared resources
- Users can access top rated and top viewed resources
- The application was developed with Golang
- gorilla/mux was used for routing
- The Postgres database was used with go-pg as the ORM
- Ensure you have Golang and Postgres installed
- Clone the project and place it in the $GOPATH/src
- Change your directory
cd WeKnow_api
- Create a .env file in the root of the directory following the format in the provided .env.example file.
- Create a database and include database credentials in the .env
- Then run
go run main.go app.go
on the terminal to start application - You can now use WeKnow_api by visiting http://localhost:port (where port is the PORT environment variable in your .env file; defaults to 3000 if not set).
To run all available migrations, run command go run migrations/*.go
which is equivalent to go run migrations/*.go up
Generally migration commands take the form go run migrations/*.go <command>
where command can be one of:
- up - runs all available migrations.
- down - reverts last migration.
- reset - reverts all migrations.
- version - prints current db version.
- set_version [version] - sets db version without running migrations.
- create [migration name] - creates a new migration file with consecutive version number and migration name
To get more information on how these migrations work, you can read up the README.md at https://github.com/go-pg/migrations
- Tests have been written to ensure the API endpoints accept the approriate input and give the right output
- Run the test with
go test