Fix README
This commit is contained in:
27
README.md
27
README.md
@@ -4,10 +4,33 @@ Headless CMS
|
||||
|
||||
## Usage
|
||||
|
||||
TODO: Describe Usage
|
||||
```js
|
||||
const Payload = require('payload');
|
||||
|
||||
// Initialize class
|
||||
const payload = new Payload({
|
||||
express: app,
|
||||
mongoose,
|
||||
baseURL: 'base123'
|
||||
});
|
||||
|
||||
// Sample collection creation
|
||||
let coolCollection = payload.newCollection('cool');
|
||||
coolCollection.add({
|
||||
test: { testProp: 'one', testProp2: 'two' }
|
||||
});
|
||||
coolCollection.register();
|
||||
|
||||
// Retrieve collection
|
||||
let retrievedCollection = payload.getCollection('cool');
|
||||
console.log(`Retrieved ${retrievedCollection.key} collection`);
|
||||
console.log(`testProp: ${coolCollection.fields.test.testProp}`);
|
||||
|
||||
// Add payload views
|
||||
app.set('views', [`${__dirname}/views`, payload.views]);
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
- `npm run` to initiate server
|
||||
- `npm test` to run test suite
|
||||
- `npm run watch` to run nodemon on the `payload` directory
|
||||
Reference in New Issue
Block a user