Go to file
Sambo Chea eca59e5e01
Merge pull request #10 from CUBETIQ/dependabot/npm_and_yarn/lint-staged-12.1.2
Bump lint-staged from 11.2.6 to 12.1.2
2021-11-26 09:15:17 +07:00
.github Create dependabot.yml 2021-09-26 18:54:22 +07:00
.husky Initial commit 2021-09-16 17:23:07 +07:00
src Add cubetiq express server module for nodejs 2021-09-16 17:49:43 +07:00
.drone.yml Updated format 2021-09-16 18:17:48 +07:00
.eslintrc.js Updated format 2021-09-16 18:17:48 +07:00
.gitignore Initial commit 2021-09-16 17:23:07 +07:00
.prettierrc.json Initial commit 2021-09-16 17:23:07 +07:00
LICENSE Initial commit 2021-09-16 17:23:07 +07:00
package.json Bump lint-staged from 11.2.6 to 12.1.2 2021-11-26 01:50:15 +00:00
README.md Add cubetiq express server module for nodejs 2021-09-16 17:49:43 +07:00
tsconfig.json Updated format 2021-09-16 18:17:48 +07:00

CUBETIQ Express Server

  • Express
  • TypeScript
  • Decorators

Getting Start

  • Add code into your index.ts
import "reflect-metadata"

import { createServer } from "http"
import server from "./server"

const app = server.instance
const httpServer = createServer(app)

httpServer.listen(process.env.PORT || 3000, () => {
    console.log(`Server listening on port: 3000`)
})
  • Create server.ts
import { Request, Response } from "express"
import { Application } from "./application"
import { Controller, Get } from "./decorators"

@Controller("/index")
class IndexController {
    @Get()
    public async index(req: Request, res: Response) {
        res.json({
            status: 200,
        })
    }
}

class Server extends Application {
    get controllers(): any[] {
        return [IndexController]
    }
}

export default new Server()

Contributors