Clone this repository:
git clone [email protected]:BCIT-DDC/node-ts-restful-api-starter.git
Install npm dependencies:
cd node-ts-restful-api-starter
npm install
npm run dev
The server is now running on http://localhost:3000
. You can now the API requests, e.g. http://localhost:3000/api/users
.
You can access the REST API of the server using the following endpoints:
/api/post/:id
: Fetch a single post by itsid
/api/user/:id/drafts
: Fetch user's drafts by theirid
/api/users
: Fetch all users
/api/post
: Create a new post- Body:
title: String
(required): The title of the postcontent: String
(optional): The content of the postauthorEmail: String
(required): The email of the user that creates the post
- Body:
/api/signup
: Create a new user- Body:
email: String
(required): The email address of the username: String
(optional): The name of the user
- Body:
/api/publish/:id
: Toggle the publish value of a post by itsid
api/post/:id/views
: Increases theviewCount
of aPost
by oneid
/api/post/:id
: Delete a post by itsid
. βββassets β βββ
icons β βββ
images βββ
docs β βββ
contributing β βββ
types-of-contributions.md βββ
scripts β βββ
copy-files.script.ts βββ
src β βββ
api β β βββ
controllers β β β βββ
post.controller.ts β β β βββ
user.controller.ts β β βββ
errors β β β βββ
application.exception.ts β β β βββ
database.exception.ts β β β βββ
http.exception.ts β β β βββ
validation.exception.ts β β βββ
helpers β β β βββ
example.helper.ts β β βββ
interfaces β β β βββ
postData.interface.ts β β β βββ
route.interface.ts β β βββ
middleware β β β βββ
error.middleware.ts β β β βββ
express.middleware.ts β β βββ
models β β β βββ
example.model.ts β β βββ
routes β β β βββ
api.route.ts β β β βββ
home.route.ts β β βββ
services β β β βββ
post.service.ts β β β βββ
user.service.ts β β βββ
utils β β β βββ
iohandler.util.ts β β β βββ
logger.util.ts β β β βββ
secrets.util.ts β β βββ
validators β β βββ
post.validator.ts β β βββ
user.validator.ts β βββ
app β β βββ
index.ts β βββ
config β β βββ
helmet.config.ts β β βββ
logger.config.ts β βββ
prisma β β βββ
db β β βββ
db.seed.ts β β βββ
schema.prisma β βββ
public β β βββ
css β β βββ
favicon.ico β β βββ
fonts β β βββ
img β β βββ
js β βββ
server.ts βββ
tests β βββ
e2e β βββ
fixtures β βββ
integration β βββ
unit β βββ
api.test.ts βββ
.env βββ
.eslintignore βββ
.eslintrc.js βββ
.gitattributes βββ
.gitignore βββ
.prettierrc.js βββ
CHANGELOG.md βββ
CODE_OF_CONDUCT.md βββ
CONTRIBUTING.md βββ
LICENSE βββ
jest.config.js βββ
package-lock.json βββ
package.json βββ
README.md βββ
SECURITY.md βββ
tsconfig.json