This is a RESTful web API built for interfacing with the Zemus mobile application.
The product has two main aspects:
- A social media platform
- A tool to search for news from the entire world.
The environment mainly consists of Node, TypeScript, Hapi, Knex.
This project is the main building block of the Zemus backend application, and is deployed on a cloud instance, running on Debian.
We are currently building a solution for crawling, indexing and storing web content (news articles), based on ElasticSearch.
Language : TypeScript
Runtime : Node.js
HTTP framework : Hapi
Authentication : Hapi/jwt
SQL query builder : Knex.js
Process manager (production) : PM2
Install dependencies
npm install
Start the server with npm script
npm run build
The transpilation to JS before the project builds and runs happens "under the hood", thanks to nodemon and ts-node.
npm run prod-js
- URL:
http://api.zemus.info - IPv4:
162.19.92.192 - Port:
8080
On all endpoints except mentionned :
- Response header - Accept: application/json, application/x-www-form-urlencoded
- Request header - Authorization: bearer *actual token*
- All query or body parameter followed by a "?" are optionnal
POST /sign-in
- payload: {email: jean@dujardin.fr, password: mdp1234!}
HEAD | GET /auth
- query: ?id=7
- headers: Authorization: bearer * actual token *
GET /search
- query:
- ?q=football
- &country=FR
- &src=journals, - no auth needed
- query:
GET /users/{id}DELETE /users/{id}POST /users
- payload:
- {firstname, lastname, email, password, country}
- payload:
PATCH /users/{id}
- payload:
- {firstname, lastname, email, password, country}
- payload:
GET /users/{id}/friendsDELETE /users/{id}/friends/{id}PUT /users/{id}/friends/{id}GET /users/{id}/friends/{id}
GET /users/{id}/favoritesGET /favorites/{id}DELETE /favorites/{id}POST /users/{id}/favorites
- payload:
- {title, link, image?, country, publication_date, description}
- payload:
GET /users/{id}/reviewsGET /reviews/{id}DELETE /reviews/{id}POST /users/{id}/reviews
- payload:
- {theme, presentation, image?, visibility_id}
- payload:
PATCH /reviews/{id}
- payload:
- {theme?, presentation?, image?, visibility_id?}
- payload:
POST /reviews/{id}/articles
- Accept: application/json
- payload:
- Array of [ FavoriteId: (int) OR {title, link, image?, country?, description?, publication_date} ]
POST /users/{id}/reviews/articles
- Accept: application/json
- payload:
- {theme, presentation, image?, visibility_id, articles}
- articles: Array of [ FavoriteId: (int) OR {title, link, image?, country?, description?, publication_date} ]
- {theme, presentation, image?, visibility_id, articles}
DELETE /reviews/{id}/articles
GET /users/{id}/feed
- query: ?page=1
GET /users/{id}/profile-picturePUT /users/{id}/profile-picture
- Accept: image/jpeg, image/png, image/gif
- payload:
- some binary image
Le projet est situé dans /srv/zemus-api sur le serveur.
Le process lié au service est relancé au démarrage du serveur, grâce à PM2.
Pour transpiler le projet dans build (en prod) :
tsc --project tsconfig.production.json