This is a training project - a simple news service with a REST-like interface, written in Haskell. It's going to support getting and publishing news, several kinds of users, authentication etc. It uses warp and PostgreSQL.
Run stack build.
- Install PostgreSQL.
- Create a database (it is called
newshere, but you may choose a different name):
createdb news
psql news -f db_schema.sql- You may populate the database with a test user. Beware: it may erase your data.
psql news -f test_data.sql- Create a configuration file. A sample, documented configuration file is
available in
conf/news-service.default.conf. To start development quickly, you can useconf/development.conffile. You may accommodate it for your needs or import it to your own configuration file, e.g.config.private.*.privatefiles are ignored by git, so it is safe to give such a name to a configuration file containing passwords for development:
import "development.conf"
postgresql {
# Overriding parameters specified in development.conf
}
news-service --config PATH_TO_CONFIGSee API documentation.
curl_scripts directory contains curl scripts to test supported requests
quickly. See how to use the scripts. You may use them
to fill the database.
If you executed test_data.sql script, you have an administrator user with the
least authentication token possible, which helps to run requests which require
authentication. The token corresponds to the pattern of <USERID>, - usually
1,.
See also code and architecture to get to know more about the code.