This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export type Result<E, S> = Failure<E, S> | Success<E, S>; | |
| export class Failure<E, S> { | |
| constructor(private _value: E) {} | |
| isError(): this is Failure<E, S> { | |
| return true; | |
| } | |
| value(): E { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require("@std/esm") | |
| module.exports = require("./main.mjs").default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const math = { | |
| sum(n1,n2) { | |
| return n1+n2; | |
| } | |
| }; | |
| export default math; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Math from './math'; | |
| import express from 'express'; | |
| const app = express(); | |
| app.get('/sum', function (req, res) { | |
| res.send(`The sum is ${Math.sum(1,1)}`) | |
| }); | |
| app.listen(3000, function () { | |
| console.log('Example app listening on port 3000!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Database = { | |
| findAll() {} | |
| } | |
| class UsersController { | |
| constructor(Database) { | |
| this.Database = Database; | |
| } | |
| getAll() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sinon from 'sinon'; | |
| const Database = { | |
| findAll() {} | |
| } | |
| class UsersController { | |
| constructor(Database) { | |
| this.Database = Database; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const loop = (gen, interval) => { | |
| const point = gen.next(); | |
| if(!point.done) { | |
| return setTimeout(() => { | |
| console.log(point.value); | |
| loop(gen, interval); | |
| }, interval); | |
| } else { | |
| console.log('done'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '2' | |
| services: | |
| library: | |
| build: . | |
| environment: | |
| NODE_ENV: production | |
| ports: | |
| - '3000:3000' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '2' | |
| services: | |
| library: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile | |
| command: node_modules/.bin/nodemon --exec npm start | |
| environment: | |
| NODE_ENV: development | |
| ports: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM node:4.3.2 | |
| RUN useradd --user-group --create-home --shell /bin/false app &&\ | |
| npm install --global [email protected] | |
| ENV HOME=/home/app | |
| COPY package.json npm-shrinkwrap.json $HOME/library/ | |
| RUN chown -R app:app $HOME/* |
NewerOlder