Git Product home page Git Product logo

amorphic-server's Introduction

CircleCI npm version

Amorphic

Description

Front-to-back isomorphic framework for developing applications with Node.js

Installation

To install using npm:

$ npm install amorphic

To get started with a more complex app see the Amorphic Ticket Demo

Usage

Create an app.js entry point as follows:

require('amorphic').listen(__dirname);

Create a config.json file top level at least the following options set:

{
    "application": "name-of-your-application",
    "applications": {
        "name-of-your-application": "directory-of-your-application"
    }
}

The directory structure for an amorphic application must be the following:

/apps - directory of all amorphic applications (can have multiple applications under this directory)
    /your-application - where all your app code lives
    /common - where all the code that is common across your applications lives

Create a schema.json file in your application directory which will contain your data schema information for persistor to persist your data to the database.

Note: The schema.json file needs at least an opening and a closing curly brace.

Start the application:

$ node app.js --port <available port>

See this blog post for more info on Amorphic and this video that demos the drpatient sample

Testing

Run all the tests:

$ npm test

Run a specific test (in this case, config test):

$ npm run test:config

License

Amorphic is licensed under the MIT license

amorphic-server's People

Contributors

bealeofsteel avatar csmastermind avatar dependabot[bot] avatar hackerrdave avatar lysandros avatar nikmash avatar nsaenz7 avatar selsamman avatar soitof avatar srksag avatar sshankar19 avatar swisslala avatar wojohaven avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

amorphic-server's Issues

Remove binds in AmorphicServer.ts

In the middlewares
.use(uploadRouter.bind(this, downloads))
fix this to utilize the arrow functions or just not use the context for binding.

Test failed

68 passing (3s)
26 failing

  1. First Group of Tests
    clears the bank and saves everything:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:144:13
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  2. First Group of Tests
    fetch everything back:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:162:13
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  3. First Group of Tests
    change results on server:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:179:13
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  4. First Group of Tests
    throw an execption:
    AssertionError: expected undefined to equal 'get stuffed'
    at test/postgres/amorphic.js:193:37
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  5. First Group of Tests
    can get it's data freshened:
    Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1163:14)

  6. First Group of Tests
    can retry an update conflict:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:234:13
    at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/release/async.js:17:14)

  7. First Group of Tests
    can do a resetSession:
    Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:259:43
    at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/release/async.js:17:14)

  8. First Group of Tests
    can get a synchronization error:

    AssertionError: expected 'An internal error occurred' to equal 'An internal error occured'

    • expected - actual

    -An internal error occurred
    +An internal error occured

    at test/postgres/amorphic.js:273:31
    at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/release/async.js:17:14)

  9. First Group of Tests
    change results on server:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:309:13
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  10. Second Group of Tests
    clears the bank and saves everything:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:331:13
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  11. Second Group of Tests
    fetch everything back:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:349:13
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  12. Second Group of Tests
    change results on server:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:367:13
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  13. Second Group of Tests
    throw an execption:
    AssertionError: expected undefined to equal 'get stuffed'
    at test/postgres/amorphic.js:380:37
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  14. Second Group of Tests
    block calls:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:413:17
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  15. Second Group of Tests
    can get it's data freshened:
    Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1163:14)

  16. Second Group of Tests
    can retry an update conflict:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:462:13
    at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/release/async.js:17:14)

  17. Second Group of Tests
    can do a resetSession:
    Error: the object {
    "code": "internal_error"
    "text": "An internal error occurred"
    } was thrown, throw an Error :)
    at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/release/async.js:17:14)

  18. Second Group of Tests
    can get a synchronization error:

    AssertionError: expected 'An internal error occurred' to equal 'An internal error occured'

    • expected - actual

    -An internal error occurred
    +An internal error occured

    at test/postgres/amorphic.js:498:31
    at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/release/async.js:17:14)

  19. Second Group of Tests
    change results on server:
    Error: done() invoked with non-Error: {"code":"internal_error","text":"An internal error occurred"}
    at test/postgres/amorphic.js:531:13
    at _rejected (node_modules/q/q.js:864:24)
    at node_modules/q/q.js:890:30
    at Promise.when (node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (node_modules/q/q.js:808:41)
    at node_modules/q/q.js:624:44
    at runSingle (node_modules/q/q.js:137:13)
    at flush (node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

  20. Ticket System Test Suite
    opens the database:
    Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

  21. Ticket System Test Suite
    clears the ticket system:
    TypeError: Cannot read property 'collection' of undefined
    at clearCollection (test/standalone/ticket.js:37:25)
    at Context. (test/standalone/ticket.js:70:9)

  22. Ticket System Test Suite
    can create stuff:
    TypeError: db.collection is not a function
    at Function.PersistObjectTemplate.savePojoToMongo (node_modules/@havenlife/persistor/dist/lib/mongo/db.js:9:29)
    at Function.PersistObjectTemplate.persistSaveMongo (node_modules/@havenlife/persistor/dist/lib/mongo/update.js:228:32)
    at template.persistSave (node_modules/@havenlife/persistor/dist/lib/api.js:641:43)
    at template.saveModel (test/standalone/model/person.js:24:25)
    at Context. (test/standalone/ticket.js:131:13)

  23. Ticket System Test Suite
    can read stuff back:
    TypeError: Cannot read property 'toString' of undefined
    at Function.PersistObjectTemplate.getFromPersistWithMongoId (node_modules/@havenlife/persistor/dist/lib/mongo/query.js:4:101)
    at Function. (node_modules/@havenlife/persistor/dist/lib/api.js:191:47)
    at step (node_modules/@havenlife/persistor/dist/lib/api.js:42:23)
    at Object.next (node_modules/@havenlife/persistor/dist/lib/api.js:23:53)
    at node_modules/@havenlife/persistor/dist/lib/api.js:17:71
    at new Promise ()
    at __awaiter (node_modules/@havenlife/persistor/dist/lib/api.js:13:12)
    at Function.template.getFromPersistWithId (node_modules/@havenlife/persistor/dist/lib/api.js:181:20)
    at Context. (test/standalone/ticket.js:150:17)

  24. Ticket System Test Suite
    can add 10 tickets:
    TypeError: db.collection is not a function
    at Function.PersistObjectTemplate.savePojoToMongo (node_modules/@havenlife/persistor/dist/lib/mongo/db.js:9:29)
    at Function.PersistObjectTemplate.persistSaveMongo (node_modules/@havenlife/persistor/dist/lib/mongo/update.js:228:32)
    at Function.PersistObjectTemplate.persistSaveMongo (node_modules/@havenlife/persistor/dist/lib/mongo/update.js:219:44)
    at Function.PersistObjectTemplate.persistSaveMongo (node_modules/@havenlife/persistor/dist/lib/mongo/update.js:146:54)
    at template.persistSave (node_modules/@havenlife/persistor/dist/lib/api.js:641:43)
    at template.saveModel (test/standalone/model/project.js:104:25)
    at Context. (test/standalone/ticket.js:208:24)

  25. Ticket System Test Suite
    can read back 5 tickets at a time:
    TypeError: Cannot read property 'toString' of undefined
    at Function.PersistObjectTemplate.getFromPersistWithMongoId (node_modules/@havenlife/persistor/dist/lib/mongo/query.js:4:101)
    at Function. (node_modules/@havenlife/persistor/dist/lib/api.js:191:47)
    at step (node_modules/@havenlife/persistor/dist/lib/api.js:42:23)
    at Object.next (node_modules/@havenlife/persistor/dist/lib/api.js:23:53)
    at node_modules/@havenlife/persistor/dist/lib/api.js:17:71
    at new Promise ()
    at __awaiter (node_modules/@havenlife/persistor/dist/lib/api.js:13:12)
    at Function.template.getFromPersistWithId (node_modules/@havenlife/persistor/dist/lib/api.js:181:20)
    at Context. (test/standalone/ticket.js:215:17)

  26. Ticket System Test Suite
    closes the database:
    TypeError: Cannot read property 'close' of undefined
    at Context. (test/standalone/ticket.js:252:12)

=============================================================================
Writing coverage object [/Users/mm67958/WorkSpace/Havenlife/amorphic/coverage/coverage.json]
Writing coverage reports at [/Users/mm67958/WorkSpace/Havenlife/amorphic/coverage]

=============================== Coverage summary ===============================
Statements : 75.63% ( 1421/1879 )
Branches : 61.32% ( 493/804 )
Functions : 62.56% ( 137/219 )
Lines : 75.69% ( 1420/1876 )

npm ERR! Test failed. See above for more details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.